Class: Chef::Knife::Cloud::VcenterClusterList
- Inherits:
-
ResourceListCommand
- Object
- ResourceListCommand
- Chef::Knife::Cloud::VcenterClusterList
- Includes:
- VcenterServiceOptions
- Defined in:
- lib/chef/knife/vcenter_cluster_list.rb
Overview
Extends ResourceListcommand to talk to vCenter
Instance Method Summary collapse
-
#before_exec_command ⇒ Object
Creates the columns and how to sort the columns.
-
#format_boolean(status) ⇒ Object
How to set the color of the text.
-
#query_resource ⇒ Object
Call service to get the list of hosts from vcenter.
Methods included from VcenterServiceOptions
Instance Method Details
#before_exec_command ⇒ Object
Creates the columns and how to sort the columns
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/chef/knife/vcenter_cluster_list.rb', line 41 def before_exec_command @columns_with_info = [ { label: "ID", key: "cluster" }, { label: "Name", key: "name" }, { label: "DRS?", key: "drs_enabled", value_callback: method(:format_boolean) }, { label: "HA?", key: "ha_enabled", value_callback: method(:format_boolean) }, ] @sort_by_field = "name" end |
#format_boolean(status) ⇒ Object
How to set the color of the text
60 61 62 63 |
# File 'lib/chef/knife/vcenter_cluster_list.rb', line 60 def format_boolean(status) status_color = status ? :green : :red ui.color(status ? "True" : "False", status_color) end |
#query_resource ⇒ Object
Call service to get the list of hosts from vcenter
54 55 56 |
# File 'lib/chef/knife/vcenter_cluster_list.rb', line 54 def query_resource service.list_clusters end |