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

Inherits:
ResourceListCommand
  • Object
show all
Includes:
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

Instance Method Details

#before_exec_commandObject

Sets up the columns for listing out and sorts by name



43
44
45
46
47
48
49
50
# 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_resourceObject

Call service to get the list of hosts from vcenter



54
55
56
# File 'lib/chef/knife/vcenter_datacenter_list.rb', line 54

def query_resource
  service.list_datacenters
end