module Fog::Proxmox::HotplugHelper
Convert hotplug settings to and from Proxmox configuration strings.
Constants
- DEFAULTS
- DEVICES
Public Class Methods
extract(hotplug)
click to toggle source
# File lib/fog/proxmox/helpers/hotplug_helper.rb, line 25 def self.extract(hotplug) hotplug = hotplug.to_s { enabled: hotplug != '0', devices: hotplug.empty? || hotplug == '1' ? DEFAULTS.dup : hotplug.split(',') } end
flatten(settings)
click to toggle source
# File lib/fog/proxmox/helpers/hotplug_helper.rb, line 33 def self.flatten(settings) return '0' unless settings[:enabled] devices = DEVICES.select { |device| settings[:devices].include?(device) } devices.empty? ? '0' : devices.join(',') end