Module: ProxmoxVMCdromHelper

Included in:
ProxmoxVMVolumesHelper
Defined in:
app/helpers/proxmox_vm_cdrom_helper.rb

Overview

Convert a foreman form server hash into a fog-proxmox server attributes hash

Instance Method Summary collapse

Instance Method Details

#parse_server_cdrom(args) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/helpers/proxmox_vm_cdrom_helper.rb', line 27

def parse_server_cdrom(args)
  cdrom_media = args['cdrom'] if args.key?('cdrom')
  return {} unless cdrom_media
  cdrom_image = args['volid'] if args.key?('volid') && cdrom_media == 'image'
  volid = if cdrom_image.present?
            cdrom_image
          elsif cdrom_media == 'none'
            'none'
          elsif ['physical', 'cdrom'].include?(cdrom_media)
            'cdrom'
          end
  return {} unless volid

  { id: 'ide2', volid: volid, media: 'cdrom' }
end