Class: Chef::Knife::EucaServerList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::EucaServerList
- Includes:
- EucaBase
- Defined in:
- lib/chef/knife/euca_server_list.rb
Instance Method Summary collapse
Methods included from EucaBase
#connection, included, #locate_config_value, #public_ip
Instance Method Details
#run ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/chef/knife/euca_server_list.rb', line 29 def run $stdout.sync = true server_list = [ ui.color('Instance ID', :bold), ui.color('Public DNS Name', :bold), ui.color('Flavor', :bold), ui.color('Image', :bold), ui.color('Security Groups', :bold), ui.color('State', :bold) ] connection.servers.all.each do |server| server_list << server.id.to_s server_list << (server.dns_name || "" ) server_list << (server.flavor_id || "") server_list << (server.image_id || "") server_list << server.groups.join(", ") server_list << begin case server.state when 'shutting-down' ui.color(server.state, :red) when 'pending' ui.color(server.state, :yellow) else ui.color(server.state, :green) end end end puts ui.list(server_list, :columns_across, 6) end |