Class: Chef::Knife::HmcServerList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::HmcServerList
- Includes:
- HmcBase
- Defined in:
- lib/chef/knife/hmc_server_list.rb
Instance Method Summary collapse
Methods included from HmcBase
#get_config, included, #tcp_ssh_alive, #validate, #validate!
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/chef/knife/hmc_server_list.rb', line 23 def run Chef::Log.debug("Listing servers...") validate! hmc = Hmc.new(get_config(:hmc_host), get_config(:hmc_username) , {:password => get_config(:hmc_password)}) hmc.connect #If frame was specified, list only the LPARs on that frame if !get_config(:frame).nil? validate!([:frame]) puts "LPARs on frame #{get_config(:frame)}:" hmc.list_lpars_on_frame(get_config(:frame)).each do |lpar_name| puts "#{lpar_name}" end else #Otherwise, list all of the LPARs on each frame #managed by this HMC frames = hmc.list_frames frames.each do |frame| puts "LPARs on frame #{frame}:" hmc.list_lpars_on_frame(frame).each do |lpar_name| puts "#{lpar_name}" end puts "\n" end end hmc.disconnect end |