1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[openstack|compute] Allow to use Symbol when specifying the hash of NICs

When use VM with NICs that was introduce in #1669, at this time the key of hash can only use String.
This commit allows to use Symbol as the key of hash.
For example, it is useful when generate hash from yaml.
This commit is contained in:
KATOH Yasufumi 2014-02-06 17:23:28 +09:00
parent 2c95cb56a1
commit 9938c92516

View file

@ -47,9 +47,9 @@ module Fog
if options['nics']
data['server']['networks'] =
Array(options['nics']).map do |nic|
neti = { 'uuid' => nic['net_id'] }
neti['fixed_ip'] = nic['v4_fixed_ip'] unless nic['v4_fixed_ip'].nil?
neti['port'] = nic['port_id'] unless nic['port_id'].nil?
neti = { 'uuid' => (nic['net_id'] || nic[:net_id]) }
neti['fixed_ip'] = (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]) unless (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]).nil?
neti['port'] = (nic['port_id'] || nic[:port_id]) unless (nic['port_id'] || nic[:port_id]).nil?
neti
end
end