Class: Chef::Knife::Cloud::OraclecloudServerList
- Inherits:
-
ServerListCommand
- Object
- ServerListCommand
- Chef::Knife::Cloud::OraclecloudServerList
- Defined in:
- lib/chef/knife/oraclecloud_server_list.rb
Instance Method Summary collapse
- #before_exec_command ⇒ Object
- #format_orchestration_value(orchestration) ⇒ Object
- #format_status_value(status) ⇒ Object
Methods included from OraclecloudServiceOptions
Methods included from OraclecloudServiceHelpers
#check_for_missing_config_values!, #create_service_instance, #verify_ssl?
Instance Method Details
#before_exec_command ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# 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) ⇒ Object
63 64 65 |
# File 'lib/chef/knife/oraclecloud_server_list.rb', line 63 def format_orchestration_value(orchestration) orchestration.nil? ? 'none' : orchestration end |
#format_status_value(status) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# 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 |