Class: Chef::Knife::Cloud::VcairVmList

Inherits:
ResourceListCommand
  • Object
show all
Includes:
VcairHelpers, VcairServiceOptions
Defined in:
lib/chef/knife/vcair_vm_list.rb

Direct Known Subclasses

VcairServerList

Instance Method Summary collapse

Methods included from VcairServiceOptions

included

Methods included from VcairHelpers

#available_networks, #config_value, #create_service_instance, #get_id, #msg_pair, #net, #network_config, #org, #template, #validate!, #vapp, #vdc, #vm

Instance Method Details

#before_exec_commandObject



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/chef/knife/vcair_vm_list.rb', line 41

def before_exec_command
  @columns_with_info = [
    {:label => 'vAPP', :key => 'vapp_name'},
    {:label => 'Name', :key => 'name'},
    {:label => 'IP', :key => 'ip_address'},
    {:label => 'CPU', :key => 'cpu'},
    {:label => 'Memory', :key => 'memory'},
    {:label => 'OS', :key => 'operating_system'},
    {:label => 'Owner', :key => 'vapp', :value_callback => method(:owner) },
    {:label => 'Status', :key => 'status'}
  ]
  @sort_by_field = 'vapp_name'
end

#owner(vapp) ⇒ Object



55
56
57
# File 'lib/chef/knife/vcair_vm_list.rb', line 55

def owner(vapp)
  vapp.owner[0][:name]
end

#query_resourceObject



33
34
35
36
37
38
39
# File 'lib/chef/knife/vcair_vm_list.rb', line 33

def query_resource
  vms = []
  vdc.vapps.all.each do |vapp|
    vms << vapp.vms.all
  end
  vms.flatten
end