File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -98,12 +98,16 @@ def self.set_mac(nic_id, nic_hash)
98
98
99
99
# Convert nic attributes hash into API Proxmox parameters string
100
100
def self . flatten ( nic_hash )
101
- nic_id = nic_hash [ nic_name ( nic_hash ) . to_sym ]
102
- nic_value = set_mac ( nic_id , nic_hash )
103
- options = nic_hash . reject do |key , _value |
104
- [ nic_name ( nic_hash ) . to_sym , :id , :macaddr , :hwaddr ] . include? key . to_sym
101
+ if nic_hash [ :hwaddr ] . nil?
102
+ nic_id = nic_hash [ nic_name ( nic_hash ) . to_sym ]
103
+ nic_value = set_mac ( nic_id , nic_hash )
104
+ options = nic_hash . reject do |key , _value |
105
+ [ nic_name ( nic_hash ) . to_sym , :id , :hwaddr , :macaddr ] . include? key . to_sym
106
+ end
107
+ nic_value += ',' + Fog ::Proxmox ::Hash . stringify ( options ) unless options . empty?
108
+ else
109
+ nic_value = Fog ::Proxmox ::Hash . stringify ( nic_hash . except ( %i[ id model macaddr ] ) ) unless nic_hash . empty?
105
110
end
106
- nic_value += ',' + Fog ::Proxmox ::Hash . stringify ( options ) unless options . empty?
107
111
{ "#{ nic_hash [ :id ] } " : nic_value }
108
112
end
109
113
You can’t perform that action at this time.
0 commit comments