Class: Chef::Knife::VsphereVlanList

Inherits:
BaseVsphereCommand show all
Defined in:
lib/chef/knife/vsphere_vlan_list.rb

Overview

Lists all known data stores in datacenter with sizes

Instance Method Summary collapse

Methods inherited from BaseVsphereCommand

#fatal_exit, #find_all_in_folder, #find_datastore, #find_folder, #find_in_folder, #find_network, #find_pool, get_common_options, #get_config, #get_vim_connection

Instance Method Details

#runObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/chef/knife/vsphere_vlan_list.rb', line 26

def run
  $stdout.sync = true
  
  vim = get_vim_connection
dcname = get_config(:vsphere_dc)
  dc = config[:vim].serviceInstance.find_datacenter(dcname) or abort "datacenter not found"
  dc.network.each do |network|
    puts "#{ui.color("VLAN", :cyan)}: #{network.name}"
  end
end