mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* OpenNebula one_vm.py: Fix missing keys
* fixup OpenNebula one_vm.py: Fix missing keys
(cherry picked from commit aaa561163b
)
Co-authored-by: Jan Orel <jorel@opennebula.io>
This commit is contained in:
parent
49b991527e
commit
e670ca666a
2 changed files with 15 additions and 4 deletions
2
changelogs/fragments/2435-one_vm-fix_missing_keys.yml
Normal file
2
changelogs/fragments/2435-one_vm-fix_missing_keys.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- one_vm - Allow missing NIC keys (https://github.com/ansible-collections/community.general/pull/2435).
|
|
@ -752,11 +752,20 @@ def get_vm_info(client, vm):
|
|||
if 'NIC' in vm.TEMPLATE:
|
||||
if isinstance(vm.TEMPLATE['NIC'], list):
|
||||
for nic in vm.TEMPLATE['NIC']:
|
||||
networks_info.append({'ip': nic['IP'], 'mac': nic['MAC'], 'name': nic['NETWORK'], 'security_groups': nic['SECURITY_GROUPS']})
|
||||
networks_info.append({
|
||||
'ip': nic.get('IP', ''),
|
||||
'mac': nic.get('MAC', ''),
|
||||
'name': nic.get('NETWORK', ''),
|
||||
'security_groups': nic.get('SECURITY_GROUPS', '')
|
||||
})
|
||||
else:
|
||||
networks_info.append(
|
||||
{'ip': vm.TEMPLATE['NIC']['IP'], 'mac': vm.TEMPLATE['NIC']['MAC'],
|
||||
'name': vm.TEMPLATE['NIC']['NETWORK'], 'security_groups': vm.TEMPLATE['NIC']['SECURITY_GROUPS']})
|
||||
networks_info.append({
|
||||
'ip': vm.TEMPLATE['NIC'].get('IP', ''),
|
||||
'mac': vm.TEMPLATE['NIC'].get('MAC', ''),
|
||||
'name': vm.TEMPLATE['NIC'].get('NETWORK', ''),
|
||||
'security_groups':
|
||||
vm.TEMPLATE['NIC'].get('SECURITY_GROUPS', '')
|
||||
})
|
||||
import time
|
||||
|
||||
current_time = time.localtime()
|
||||
|
|
Loading…
Reference in a new issue