Class: Chef::Knife::SceVlanList

Inherits:
Chef::Knife show all
Includes:
SceBase
Defined in:
lib/chef/knife/sce_vlan_list.rb

Instance Method Summary collapse

Methods included from SceBase

#connection, #connection_storage, #datacenter_id, included, #locate_config_value, #msg_pair, #validate!

Instance Method Details

#runObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/chef/knife/sce_vlan_list.rb', line 32

def run
  $stdout.sync = true

  validate!
  
  vlan_list = [
    ui.color('Name', :bold),
    ui.color('VLAN ID', :bold),
    ui.color("Location", :bold)
  ].flatten.compact
  
  output_column_count = vlan_list.length
  
  vlans = run!
  
  vlans.each do |vlan|
    vlan_list << vlan.name.to_s
    vlan_list << vlan.id.to_s
    vlan_list << connection.locations.get(vlan.location).name.to_s
  end
  
  puts ui.list(vlan_list, :uneven_columns_across, output_column_count)

end

#run!Object



28
29
30
# File 'lib/chef/knife/sce_vlan_list.rb', line 28

def run!
  connection.vlans.all
end