Class: Chef::Knife::UcsOrgsList

Inherits:
Chef::Knife show all
Includes:
UCSBase
Defined in:
lib/chef/knife/ucs_orgs_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
47
48
# File 'lib/chef/knife/ucs_orgs_list.rb', line 30

def run
  $stdout.sync = true
  
  #Using Chef's UI (much better looking:)) instead of list methods provided by ucslib.
  
  orgs_list = [
    ui.color('Path',    :bold),
    ui.color('Level',   :bold),
    ui.color('Name',    :bold)
  ]
  
  inventory.xpath("configResolveClasses/outConfigs/orgOrg").each do |org|
    orgs_list << "#{org.attributes["dn"]}"
    orgs_list << "#{org.attributes["level"]}"
    orgs_list << "#{org.attributes["name"]}"
  end        
  puts ui.list(orgs_list, :uneven_columns_across, 3)
  
end