From b6b512fda98c1c48cd3adf6ea90f40f00bcc9ec7 Mon Sep 17 00:00:00 2001 From: Tom Paine Date: Wed, 21 Aug 2024 14:47:48 +0100 Subject: [PATCH] fix attribute test --- plugins/inventory/opennebula.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/inventory/opennebula.py b/plugins/inventory/opennebula.py index 34e9df311a..f352b505ac 100644 --- a/plugins/inventory/opennebula.py +++ b/plugins/inventory/opennebula.py @@ -200,8 +200,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable): server['name'] = vm.NAME server['id'] = vm.ID - if vm.HISTORY_RECORDS.HISTORY: - server['host'] = vm.HISTORY_RECORDS.HISTORY[-1].HOSTNAME + if 'HISTORY' in vm.HISTORY_RECORDS: + if vm.HISTORY_RECORDS['HISTORY']: + server['host'] = vm.HISTORY_RECORDS.HISTORY[-1].HOSTNAME server['LABELS'] = labels server['v4_first_ip'] = self._get_vm_ipv4(vm) server['v6_first_ip'] = self._get_vm_ipv6(vm)