Class: Chef::Knife::Cloud::OpenstackFlavorList

Inherits:
ResourceListCommand
  • Object
show all
Includes:
OpenstackHelpers, OpenstackServiceOptions
Defined in:
lib/chef/knife/openstack_flavor_list.rb

Instance Method Summary collapse

Methods included from OpenstackServiceOptions

included

Methods included from OpenstackHelpers

#create_service_instance, #instance_addresses, #primary_network_ip_address, #primary_private_ip_address, #primary_public_ip_address, #validate!

Instance Method Details

#before_exec_commandObject



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/chef/knife/openstack_flavor_list.rb', line 32

def before_exec_command
  # set columns_with_info map
  @columns_with_info = [
    { label: "Name", key: "name" },
    { label: "ID", key: "id" },
    { label: "Virtual CPUs", key: "vcpus" },
    { label: "RAM", key: "ram", value_callback: method(:ram_in_mb) },
    { label: "Disk", key: "disk", value_callback: method(:disk_in_gb) },
  ]
  @sort_by_field = "name"
end

#disk_in_gb(disk) ⇒ Object



52
53
54
# File 'lib/chef/knife/openstack_flavor_list.rb', line 52

def disk_in_gb(disk)
  "#{disk} GB"
end

#query_resourceObject



44
45
46
# File 'lib/chef/knife/openstack_flavor_list.rb', line 44

def query_resource
  @service.list_resource_configurations
end

#ram_in_mb(ram) ⇒ Object



48
49
50
# File 'lib/chef/knife/openstack_flavor_list.rb', line 48

def ram_in_mb(ram)
  "#{ram} MB"
end