1
0
Fork 0
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:
Simon 2026-06-29 21:39:08 +02:00 committed by GitHub
parent 3e239e5853
commit bbf8bb47d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View 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).

View file

@ -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]