os_server: keep optional nic args for nics specified using net-name or port-name. (#20969)

pull/61248/head
Victor Costan 5 years ago committed by ansibot
parent fabd912fa5
commit 943b4f5a83

@ -448,7 +448,10 @@ def _network_args(module, cloud):
module.fail_json(
msg='Could not find network by net-name: %s' %
net['net-name'])
args.append({'net-id': by_name['id']})
resolved_net = net.copy()
del resolved_net['net-name']
resolved_net['net-id'] = by_name['id']
args.append(resolved_net)
elif net.get('port-id'):
args.append(net)
elif net.get('port-name'):
@ -457,7 +460,10 @@ def _network_args(module, cloud):
module.fail_json(
msg='Could not find port by port-name: %s' %
net['port-name'])
args.append({'port-id': by_name['id']})
resolved_net = net.copy()
del resolved_net['port-name']
resolved_net['port-id'] = by_name['id']
args.append(resolved_net)
return args

Loading…
Cancel
Save