Class: Chef::Knife::OcaTemplateList

Inherits:
Chef::Knife show all
Includes:
OcaBase
Defined in:
lib/chef/knife/oca_template_list.rb

Instance Method Summary collapse

Methods included from OcaBase

#connection, #dns_reverse_lookup, included, #locate_config_value, #msg_pair, #validate!

Instance Method Details

#runObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/chef/knife/oca_template_list.rb', line 32

def run

  validate!

  flavor_list = [
    ui.color('ID', :bold),
    ui.color('Name', :bold),
    ui.color('Architecture', :bold),
    ui.color('CPUs', :bold),
    ui.color('Memory', :bold)
  ]
  connection.templates.all.each do |template|
    flavor_list << template.id.to_s
    flavor_list << template.name.to_s
    flavor_list << template.template['OS']['ARCH']
    flavor_list << template.template['VCPU']
    flavor_list << template.template['MEMORY']
  end
  puts ui.list(flavor_list, :uneven_columns_across, 5)
end