1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-06-30 07:50:43 +00:00

[PR #12361/bbf8bb47 backport][stable-12] OpenNebula inventory fails if VM without NIC exists (#12365)

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



---------


(cherry picked from commit bbf8bb47d9)

Co-authored-by: Simon <4375225+skropf@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2026-06-30 04:46:57 +00:00 committed by GitHub
parent c046ffe5fa
commit 7035d14d80
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

@ -133,6 +133,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]
@ -145,6 +148,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]