class Chef::Knife::Cloud::VcenterDatacenterList

Extends the ResourceListCommand for specific vCenter

Public Instance Methods

before_exec_command() click to toggle source

Sets up the columns for listing out and sorts by name

# File lib/chef/knife/vcenter_datacenter_list.rb, line 43
def before_exec_command
  @columns_with_info = [
    { label: "ID",    key: "datacenter" },
    { label: "Name",  key: "name" },
  ]

  @sort_by_field = "name"
end
query_resource() click to toggle source

Call service to get the list of hosts from vcenter

# File lib/chef/knife/vcenter_datacenter_list.rb, line 54
def query_resource
  service.list_datacenters
end