Module: ForemanFogProxmox::HostsController::Overrides

Includes:
ProxmoxVmNew
Defined in:
app/controllers/concerns/foreman_fog_proxmox/hosts_controller.rb

Instance Method Summary collapse

Methods included from ProxmoxVmNew

#add_default_typed_interface, #add_default_typed_volume, #cdrom_defaults, #cloudinit_defaults, #config_attributes, #convert_config_attributes, #default_node, #default_node_id, #hard_disk_typed_defaults, #interface_defaults, #interface_typed_defaults, #new_interface, #new_typed_interface, #new_typed_vm, #new_typed_volume, #new_vm, #new_volume, #next_vmid, #vm_instance_defaults, #vm_typed_instance_defaults

Methods included from ProxmoxVmHelper

#parse_typed_vm, #vm_collection

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

#cloneObject

Clone the host



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/concerns/foreman_fog_proxmox/hosts_controller.rb', line 29

def clone
  super
  return true unless @host.compute_resource.instance_of?(ForemanFogProxmox::Proxmox)

  @host.compute_attributes[:vmid] = next_vmid
  @host.compute_attributes[:interfaces_attributes].each do |index, interface_attributes|
    @host.compute_attributes[:interfaces_attributes][index] =
      interface_attributes.merge(macaddr: nil).merge(hwaddr: nil).merge(ip: nil).merge(ip6: nil)
  end
  @host.compute_attributes[:volumes_attributes].each do |index, volume_attributes|
    @host.compute_attributes[:volumes_attributes][index] = volume_attributes.merge(volid: nil)
  end
end