mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-07-02 16:48:56 +00:00
OpenNebula inventory fails if VM without NIC exists (#12361)
* fix error of opennebula plugin when retrieving VM without NIC * add changelog fragment * added more descriptive name, added link to PR Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
3e239e5853
commit
bbf8bb47d9
2 changed files with 8 additions and 0 deletions
2
changelogs/fragments/fix-opennebula_vm_without_nic.yml
Normal file
2
changelogs/fragments/fix-opennebula_vm_without_nic.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- opennebula inventory plugin - fix crash when retrieving VM without NIC (https://github.com/ansible-collections/community.general/pull/12361).
|
||||
|
|
@ -138,6 +138,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||
def _get_vm_ipv4(self, vm):
|
||||
nic = vm.TEMPLATE.get("NIC")
|
||||
|
||||
if not nic:
|
||||
return False
|
||||
|
||||
if isinstance(nic, dict):
|
||||
nic = [nic]
|
||||
|
||||
|
|
@ -150,6 +153,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||
def _get_vm_ipv6(self, vm):
|
||||
nic = vm.TEMPLATE.get("NIC")
|
||||
|
||||
if not nic:
|
||||
return False
|
||||
|
||||
if isinstance(nic, dict):
|
||||
nic = [nic]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue