Class: Chef::Knife::OneandoneApplianceList

Inherits:
Chef::Knife
  • Object
show all
Includes:
OneandoneBase
Defined in:
lib/chef/knife/oneandone_appliance_list.rb

Instance Method Summary collapse

Methods included from OneandoneBase

#formated_output, included, #init_client

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/chef/knife/oneandone_appliance_list.rb', line 10

def run
  $stdout.sync = true

  init_client

  response = OneAndOne::ServerAppliance.new.list
  formated_output(response, true)

  sizes = [
    ui.color('ID', :bold),
    ui.color('Name', :bold),
    ui.color('Type', :bold),
    ui.color('OS', :bold),
    ui.color('Version', :bold),
    ui.color('Architecture', :bold)
  ]
  response.each do |fs|
    sizes << fs['id']
    sizes << fs['name']
    sizes << fs['type']
    sizes << fs['os']
    sizes << fs['version']
    sizes << fs['os_architecture'].to_s
  end

  puts ui.list(sizes, :uneven_columns_across, 6)
end