Method: KnifeCloudstack::CsServiceList#run

Defined in:
lib/chef/knife/cs_service_list.rb

#runObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/chef/knife/cs_service_list.rb', line 50

def run

  connection = CloudstackClient::Connection.new(
      locate_config_value(:cloudstack_url),
      locate_config_value(:cloudstack_api_key),
      locate_config_value(:cloudstack_secret_key)
  )

  service_list = [
      ui.color('Name', :bold),
      ui.color('Memory', :bold),
      ui.color('CPUs', :bold),
      ui.color('CPU Speed', :bold),
      ui.color('Created', :bold)
  ]

  services = connection.list_service_offerings
  services.each do |s|
    service_list << s['name']
    service_list << (human_memory(s['memory']) || 'Unknown')
    service_list << s['cpunumber'].to_s
    service_list << s['cpuspeed'].to_s + ' Mhz'
    service_list << s['created']
  end
  puts ui.list(service_list, :columns_across, 5)

end