Class: Chef::Knife::UcsPolicyCreate
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::UcsPolicyCreate
- Includes:
- UCSBase
- Defined in:
- lib/chef/knife/ucs_policy_create.rb
Instance Attribute Summary collapse
-
#initial_sleep_delay ⇒ Object
Returns the value of attribute initial_sleep_delay.
Instance Method Summary collapse
Methods included from UCSBase
#connection, #destroyer, included, #inventory, #locate_config_value, #manager, #msg_pair, #provisioner
Instance Attribute Details
#initial_sleep_delay ⇒ Object
Returns the value of attribute initial_sleep_delay.
37 38 39 |
# File 'lib/chef/knife/ucs_policy_create.rb', line 37 def initial_sleep_delay @initial_sleep_delay end |
Instance Method Details
#run ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/chef/knife/ucs_policy_create.rb', line 76 def run $stdout.sync = true policy = "#{Chef::Config[:knife][:policy]}".downcase case policy when 'host-firmware' json = { :host_firmware_pkg_name => Chef::Config[:knife][:name], :hardware_model => Chef::Config[:knife][:hardwaremodel].to_s, :hardware_type => Chef::Config[:knife][:hardwaretype].to_s, :hardware_vendor => Chef::Config[:knife][:hardwarevendor].to_s, :firmware_version => Chef::Config[:knife][:firmwareversion].to_s, :org => Chef::Config[:knife][:org] }.to_json xml_response = provisioner.set_host_firmware_package(json) xml_doc = Nokogiri::XML(xml_response) xml_doc.xpath("configConfMos/outConfigs/pair/firmwareComputeHostPack").each do |hostfw| puts '' puts "Host Firmware Pack: #{ui.color("#{hostfw.attributes['name']}", :blue)}" + " status: #{ui.color("#{hostfw.attributes['status']}", :green)}" end xml_doc.xpath("configConfMos").each do |hostfw| puts "#{hostfw.attributes['errorCode']} #{ui.color("#{hostfw.attributes['errorDescr']}", :red)}" end else puts "Incorrect options. Please make sure you are using one of the following: host-firmware, mgmt-firmware" end end |