Class: Chef::Knife::TerremarkServerList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::TerremarkServerList
- Defined in:
- lib/chef/knife/terremark_server_list.rb
Constant Summary
Constants inherited from Chef::Knife
Instance Attribute Summary
Attributes inherited from Chef::Knife
Instance Method Summary collapse
Methods inherited from Chef::Knife
#ask_question, #bulk_delete, category, #configure_chef, #confirm, #create_object, #delete_object, #edit_data, #edit_object, #file_exists_and_is_readable?, #format_for_display, #format_list_for_display, guess_category, inherited, #initialize, list_commands, load_commands, #load_from_file, #msg, msg, #output, #parse_options, #pretty_print, #rest, run, #show_usage, snake_case_name, #stdin, #stdout, subcommand_category, subcommand_class_from, subcommands, subcommands_by_category, unnamed?
Methods included from Mixin::ConvertToClassName
#convert_to_class_name, #convert_to_snake_case, #filename_to_qualified_string, #snake_case_basename
Constructor Details
This class inherits a constructor from Chef::Knife
Instance Method Details
#h ⇒ Object
47 48 49 |
# File 'lib/chef/knife/terremark_server_list.rb', line 47 def h @highline ||= HighLine.new end |
#run ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/chef/knife/terremark_server_list.rb', line 51 def run require 'fog' require 'highline' server_name = @name_args[0] terremark = Fog::Terremark.new( :terremark_username => Chef::Config[:knife][:terremark_username], :terremark_password => Chef::Config[:knife][:terremark_password], :terremark_service => Chef::Config[:knife][:terremark_service] || :vcloud ) $stdout.sync = true server_list = [ h.color('ID', :bold), h.color('Name', :bold) ] terremark.servers.all.each do |server| server_list << server.id.to_s server_list << server.name end puts h.list(server_list, :columns_across, 2) end |