Class: Chef::Knife::GlesysTemplateList

Inherits:
Chef::Knife show all
Includes:
GlesysBase
Defined in:
lib/chef/knife/glesys_template_list.rb

Instance Method Summary collapse

Methods included from GlesysBase

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

Instance Method Details

#runObject



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/glesys_template_list.rb', line 16

def run

  template_list = [
    ui.color('Platform', :bold),
    ui.color('Name', :bold),
    ui.color('Operating System', :bold),
    ui.color('Min Memory Size', :bold),
    ui.color('Min Disk Size', :bold),

  ]

  connection.templates.sort_by(&:platform).each do |template|
    template_list << template.platform
    template_list << template.name
    template_list << template.operating_system
    template_list << "#{template.minimum_memory_size} mb"
    template_list << "#{template.minimum_disk_size} gb"
  end

  puts ui.list(template_list, :columns_across, 5)
end