Class: Chef::Knife::Cloud::VcenterDatacenterList

Inherits:
ResourceListCommand
  • Object
show all
Includes:
VcenterServiceHelpers, VcenterServiceOptions
Defined in:
lib/chef/knife/vcenter_datacenter_list.rb

Overview

Extends the ResourceListCommand for specific vCenter

Instance Method Summary collapse

Methods included from VcenterServiceOptions

included

Methods included from VcenterServiceHelpers

#check_for_missing_config_values!, #create_service_instance, #validate!, #verify_ssl?

Instance Method Details

#before_exec_commandObject

Sets up the columns for listing out and sorts by name



40
41
42
43
44
45
46
47
# File 'lib/chef/knife/vcenter_datacenter_list.rb', line 40

def before_exec_command
  @columns_with_info = [
    { label: "ID",    key: "datacenter" },
    { label: "Name",  key: "name" }
  ]

  @sort_by_field = "name"
end

#query_resourceObject

Call service to get the list of hosts from vcenter



51
52
53
# File 'lib/chef/knife/vcenter_datacenter_list.rb', line 51

def query_resource
  service.list_datacenters
end