Class: Chef::Knife::UcsVlanCreate

Inherits:
Chef::Knife show all
Includes:
UCSBase
Defined in:
lib/chef/knife/ucs_vlan_create.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UCSBase

#connection, #destroyer, included, #inventory, #locate_config_value, #manager, #msg_pair, #provisioner

Instance Attribute Details

#initial_sleep_delayObject

Returns the value of attribute initial_sleep_delay.



37
38
39
# File 'lib/chef/knife/ucs_vlan_create.rb', line 37

def initial_sleep_delay
  @initial_sleep_delay
end

Instance Method Details

#runObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/chef/knife/ucs_vlan_create.rb', line 49

def run
  $stdout.sync = true
  
  json = {:vlan_id => Chef::Config[:knife][:vlanid], :vlan_name => Chef::Config[:knife][:vlanname] }.to_json
  
  xml_response = provisioner.set_vlan(json)
  xml_doc = Nokogiri::XML(xml_response)
  
  xml_doc.xpath("configConfMos/outConfigs/pair/fabricVlan").each do |org|
      puts ''
      puts "VLAN ID: #{ui.color("#{org.attributes['id']}", :blue)} NAME: #{ui.color("#{org.attributes['name']}", :blue)}" + 
            " status: #{ui.color("#{org.attributes['status']}", :red)}"
  end        
  
  xml_doc.xpath("configConfMos").each do |org|
     puts "#{org.attributes['errorCode']} #{ui.color("#{org.attributes['errorDescr']}", :red)}"
  end        
  
end