Class: Chef::Knife::Cloud::VraServerList

Inherits:
ServerListCommand
  • Object
show all
Includes:
VraServiceOptions
Defined in:
lib/chef/knife/vra_server_list.rb

Instance Method Summary collapse

Methods included from VraServiceOptions

included

Instance Method Details

#before_exec_commandObject


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

def before_exec_command
  @columns_with_info = [
    { label: "Resource ID",  key: "id" },
    { label: "Name",         key: "name" },
    { label: "Status",       key: "status", value_callback: method(:format_status_value) },
    { label: "Catalog Name", key: "catalog_name" },
  ]

  @sort_by_field = "name"
end

#format_status_value(status) ⇒ Object


51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/chef/knife/vra_server_list.rb', line 51

def format_status_value(status)
  status = status.downcase
  status_color = case status
                 when "active"
                   :green
                 when "deleted"
                   :red
                 else
                   :yellow
                 end
  ui.color(status, status_color)
end