class Chef::Knife::Cloud::GoogleServerList

Public Instance Methods

before_exec_command() click to toggle source
# File lib/chef/knife/google_server_list.rb, line 42
def before_exec_command
  @columns_with_info = [
    { label: "Instance Name", key: "name" },
    { label: "Status",        key: "status", value_callback: method(:format_status_value) },
    { label: "Machine Type",  key: "machine_type" },
    { label: "Internal IP",   key: "private_ip" },
    { label: "External IP",   key: "public_ip" },
    { label: "Network",       key: "network" },
  ]

  @sort_by_field = "name"
end
format_status_value(status) click to toggle source
# File lib/chef/knife/google_server_list.rb, line 55
def format_status_value(status)
  status = status.downcase
  status_color = case status
                 when "stopping", "stopped", "terminated"
                   :red
                 when "requested", "provisioning", "staging"
                   :yellow
                 else
                   :green
                 end

  ui.color(status, status_color)
end
validate_params!() click to toggle source
Calls superclass method
# File lib/chef/knife/google_server_list.rb, line 37
def validate_params!
  check_for_missing_config_values!(:gce_zone)
  super
end