Class: Chef::Knife::ProfitbricksLanList

Inherits:
Chef::Knife show all
Includes:
ProfitbricksBase
Defined in:
lib/chef/knife/profitbricks_lan_list.rb

Instance Method Summary collapse

Methods included from ProfitbricksBase

#connection, #error_and_exit, #get_image, included, #msg_pair, #validate_required_params

Instance Method Details

#runObject



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

def run
  $stdout.sync = true
  lan_list = [
    ui.color('ID', :bold),
    ui.color('Name', :bold),
    ui.color('Public', :bold),
  ]
  connection

  ProfitBricks::LAN.list(Chef::Config[:knife][:datacenter_id]).each do |lan|
    lan_list << lan.id
    lan_list << lan.properties['name']
    lan_list << lan.properties['public'].to_s
  end

  puts ui.list(lan_list, :uneven_columns_across, 3)
end