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:
parent
c046ffe5fa
commit
7035d14d80
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).
|
||||
|
|
@ -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]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue