Class: Chef::Knife::BlueboxLocationList

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

Instance Method Summary collapse

Instance Method Details

#hObject



33
34
35
# File 'lib/chef/knife/bluebox_location_list.rb', line 33

def h
  @highline ||= HighLine.new
end

#runObject



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

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]
  )

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

  bluebox.locations.each do |location|
    location_list << location.id.to_s
    location_list << location.description
  end
  puts h.list(location_list, :columns_across, 2)

end