Class: Chef::Knife::ProxmoxServerInfo

Inherits:
Chef::Knife show all
Includes:
ProxmoxBase
Defined in:
lib/chef/knife/proxmox_server_info.rb

Instance Method Summary collapse

Methods included from ProxmoxBase

#action_response, #check_config_parameter, #check_global_parameter, #connection, #destroy_item, included, #locate_config_value, #new_vmid, #server_create, #server_destroy, #server_get_data, #server_modify, #server_name_to_vmid, #server_start, #server_stop, #server_umount, #template_number_to_name, #vmid_to_node, #waitfor

Instance Method Details

#runObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/chef/knife/proxmox_server_info.rb', line 28

def run
  # Needed
  connection
  
  vm_id = nil
  name = nil
  if (config[:vm_id].nil? and config[:chef_node_name].nil?) then
    ui.error("You must use -I <id> or -H <Hostname>")
    exit 1
  elsif (!config[:chef_node_name].nil?)
      name = config[:chef_node_name]
      vm_id = server_name_to_vmid(name)
  else
    vm_id = config[:vm_id]
  end
  
  parameter = config[:parameter] || 'all'
  
  data = server_get_data(vm_id,parameter)
  ui.output(data)
end