Class: Chef::Knife::EucaImageList

Inherits:
Chef::Knife show all
Includes:
EucaBase
Defined in:
lib/chef/knife/euca_image_list.rb

Instance Method Summary collapse

Methods included from EucaBase

#connection, included, #locate_config_value, #public_ip

Instance Method Details

#runObject



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

def run
  image_list = [
    ui.color('ID', :bold),
    ui.color('Kernel ID', :bold),
    ui.color('Architecture', :bold),
    ui.color('Location', :bold)
  ]

  connection.images.sort_by do |image|
    [image.location, image.architecture].compact
  end.each do |image|
    image_list << image.id
    image_list << image.kernel_id
    image_list << image.architecture
    image_list << image.location
  end

  image_list = image_list.map do |item|
    item.to_s
  end

  puts ui.list(image_list, :columns_across, 4)
end