Class: Knifecosmic::CosmicVolumeList

Inherits:
Chef::Knife show all
Includes:
Chef::Knife::KnifecosmicBaseList
Defined in:
lib/chef/knife/cosmic_volume_list.rb

Instance Method Summary collapse

Methods included from Chef::Knife::KnifecosmicBaseList

included, #list_object, #list_object_fields, #output_format

Instance Method Details

#runObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/chef/knife/cosmic_volume_list.rb', line 46

def run
  validate_base_options

  columns = [
    'Name    :name',
    'Account :account',
    'Domain  :domain',
    'State   :state',
    'VMName  :vmname',
    'VMState :vmstate'
  ]

  params = { 'command' => "listVolumes" }
  params['filter']  = locate_config_value(:filter)  if locate_config_value(:filter)
  params['listall'] = locate_config_value(:listall) if locate_config_value(:listall)
  params['keyword'] = locate_config_value(:keyword) if locate_config_value(:keyword)
  params['name']    = locate_config_value(:name)    if locate_config_value(:name)
  if locate_config_value(:vmname)
    vm = connection.get_server(locate_config_value(:vmname))
    params['virtualmachineid'] = vm['id']
  end
  
  @volumelist = connection.list_object(params, "volume")
  list_object(columns, @volumelist)
end

#volumelistObject



72
73
74
# File 'lib/chef/knife/cosmic_volume_list.rb', line 72

def volumelist
  @volumelist
end