class Chef::Knife::Cloud::OraclecloudServerList

Public Instance Methods

before_exec_command() click to toggle source
# File lib/chef/knife/oraclecloud_server_list.rb, line 37
def before_exec_command
  @columns_with_info = [
    { label: 'Hostname',         key: 'hostname' },
    { label: 'Status',           key: 'status', value_callback: method(:format_status_value) },
    { label: 'Shape',            key: 'shape' },
    { label: 'Image',            key: 'image' },
    { label: 'Instance ID',      key: 'id' },
    { label: 'Orchestration ID', key: 'orchestration', value_callback: method(:format_orchestration_value) }
  ]

  @sort_by_field = 'name'
end
format_orchestration_value(orchestration) click to toggle source
# File lib/chef/knife/oraclecloud_server_list.rb, line 63
def format_orchestration_value(orchestration)
  orchestration.nil? ? 'none' : orchestration
end
format_status_value(status) click to toggle source
# File lib/chef/knife/oraclecloud_server_list.rb, line 50
def format_status_value(status)
  status = status.downcase
  status_color = case status
                 when 'running'
                   :green
                 when 'stopped'
                   :red
                 else
                   :yellow
                 end
  ui.color(status, status_color)
end