Class: Chef::Knife::BlueboxFlavorList

Inherits:
Chef::Knife show all
Defined in:
lib/chef/knife/bluebox_flavor_list.rb

Instance Method Summary collapse

Instance Method Details

#hObject



34
35
36
# File 'lib/chef/knife/bluebox_flavor_list.rb', line 34

def h
  @highline ||= HighLine.new
end

#runObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/chef/knife/bluebox_flavor_list.rb', line 38

def run
  bluebox = Fog::Compute::Bluebox.new(
    :bluebox_customer_id => Chef::Config[:knife][:bluebox_customer_id],
    :bluebox_api_key => Chef::Config[:knife][:bluebox_api_key]
  )

  flavor_list = [ h.color('ID', :bold), h.color('Description', :bold) ]

  bluebox.flavors.each do |flavor|
    flavor_list << flavor.id.to_s
    flavor_list << flavor.description
  end
  puts h.list(flavor_list, :columns_across, 2)

end