Module: ProxmoxVmHelper

Instance Method Summary collapse

Methods included from ProxmoxVmOsTemplateHelper

#ostemplate_keys, #parse_container_ostemplate, #parse_ostemplate, #parse_ostemplate_without_keys

Methods included from ProxmoxVmConfigHelper

#args_a, #config_a, #config_general_or_ostemplate_key?, #config_options, #config_typed_keys, #general_a, #object_to_config_hash, #parse_typed_cpu, #parse_typed_memory, #parsed_typed_config

Methods included from ProxmoxVmVolumesHelper

#add_disk_options, #add_typed_volume, #parse_hard_disk_volume, #parse_typed_volume, #parse_typed_volumes, #parsed_typed_volumes, #remove_volume_keys, #volume_type?

Methods included from ProxmoxVmCloudinitHelper

#parse_server_cloudinit

Methods included from ProxmoxVmCdromHelper

#parse_server_cdrom

Methods included from ProxmoxVmInterfacesHelper

#add_or_delete_typed_interface, #compute_dhcps, #interface_common_typed_keys, #interface_compute_attributes_typed_keys, #parse_typed_interfaces, #parsed_typed_interfaces

Instance Method Details

#parse_typed_vm(args, type) ⇒ Object

Convert a foreman form server/container vm hash into a fog-proxmox server/container attributes hash



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'app/helpers/proxmox_vm_helper.rb', line 37

def parse_typed_vm(args, type)
  args = ActiveSupport::HashWithIndifferentAccess.new(args)
  return {} unless args
  return {} if args.empty?
  return {} unless args['type'] == type

  logger.debug("parse_typed_vm(#{type}): args=#{args}")
  parsed_vm = parsed_typed_config(args, type)
  parsed_vm = parsed_typed_interfaces(args, type, parsed_vm)
  parsed_vm = parsed_typed_volumes(args, type, parsed_vm)
  logger.debug("parse_typed_vm(#{type}): parsed_vm=#{parsed_vm}")
  parsed_vm
end

#vm_collection(type) ⇒ Object



30
31
32
33
34
# File 'app/helpers/proxmox_vm_helper.rb', line 30

def vm_collection(type)
  collection = :servers
  collection = :containers if type == 'lxc'
  collection
end