Class: Chef::Knife::UcsVlansList

Inherits:
Chef::Knife show all
Includes:
UCSBase
Defined in:
lib/chef/knife/ucs_vlans_list.rb

Instance Method Summary collapse

Methods included from UCSBase

#connection, #destroyer, included, #inventory, #locate_config_value, #manager, #msg_pair, #provisioner

Instance Method Details

#runObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/chef/knife/ucs_vlans_list.rb', line 30

def run
  $stdout.sync = true
  
  #Using Chef's UI (much better looking:)) instead of list methods provided by ucslib.
  
  vlans_list = [
    ui.color('ID',    :bold),
    ui.color('Name',  :bold)
  ]
  
  inventory.xpath("configResolveClasses/outConfigs/fabricVlan").each do |fabricvlan|
    vlans_list << "#{fabricvlan.attributes["id"]}"
    vlans_list << "#{fabricvlan.attributes["name"]}"
  end        
  puts ui.list(vlans_list, :columns_across, 2)
  
end