Class: Chef::Knife::AcropolisImage

Inherits:
Chef::Knife show all
Includes:
AcropolisBase
Defined in:
lib/chef/knife/acropolis_image_list.rb

Instance Method Summary collapse

Methods included from AcropolisBase

#delete, #get, included, #post, #validate

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/chef/knife/acropolis_image_list.rb', line 15

def run    
  im_list = [
    ui.color('UUID', :bold),
    ui.color('Name', :bold),
    ui.color('Type', :bold),
    ui.color('State', :bold)
  ]

  ha = get("/images")
  info = JSON.parse(ha)
  info["entities"].sort_by do |image|
    im_list << image["uuid"].to_s
    im_list << image["name"].to_s
    im_list << image["imageType"].to_s
    im_list << image["imageState"].to_s
  end
  print ui.list(im_list, :uneven_columns_across, 4)
end