Class: Chef::Knife::Cloud::OraclecloudImageList

Inherits:
ResourceListCommand
  • Object
show all
Includes:
OraclecloudServiceHelpers, OraclecloudServiceOptions
Defined in:
lib/chef/knife/oraclecloud_image_list.rb

Instance Method Summary collapse

Methods included from OraclecloudServiceOptions

included

Methods included from OraclecloudServiceHelpers

#check_for_missing_config_values!, #create_service_instance, #verify_ssl?

Instance Method Details

#before_exec_commandObject



36
37
38
39
40
41
42
43
# File 'lib/chef/knife/oraclecloud_image_list.rb', line 36

def before_exec_command
  @columns_with_info = [
    { label: 'Image Name',  key: 'name' },
    { label: 'Description', key: 'description' }
  ]

  @sort_by_field = 'name'
end

#format_status_value(status) ⇒ Object



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

def format_status_value(status)
  status = status.downcase
  status_color = case status
                 when 'ready'
                   :green
                 when 'stopped'
                   :red
                 else
                   :yellow
                 end

  ui.color(status, status_color)
end

#query_resourceObject



45
46
47
# File 'lib/chef/knife/oraclecloud_image_list.rb', line 45

def query_resource
  service.list_images
end