Class: Chef::Knife::UcsOrgDelete

Inherits:
Chef::Knife show all
Includes:
UCSBase
Defined in:
lib/chef/knife/ucs_org_delete.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_org_delete.rb', line 37

def initial_sleep_delay
  @initial_sleep_delay
end

Instance Method Details

#runObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/chef/knife/ucs_org_delete.rb', line 46

def run
  $stdout.sync = true
  
  xml_response = destroyer.delete_org({:org => Chef::Config[:knife][:org]}.to_json)
  xml_doc = Nokogiri::XML(xml_response)
  
  xml_doc.xpath("configConfMos/outConfigs/pair/orgOrg").each do |org|
      puts ''
      puts "Org: #{ui.color("#{org.attributes['name']}", :blue)} status: #{ui.color("#{org.attributes['status']}", :red)}"
  end

  #Ugly...refactor later to parse error with better exception handling. Nokogiri xpath search for elements might be an option
  xml_doc.xpath("configConfMos").each do |org|
     puts "#{org.attributes['errorCode']} #{ui.color("#{org.attributes['errorDescr']}", :red)}"
  end

  
end