diff --git a/plugins/inventory/opennebula.py b/plugins/inventory/opennebula.py index ce9919ab2b..b0a60f3265 100644 --- a/plugins/inventory/opennebula.py +++ b/plugins/inventory/opennebula.py @@ -202,9 +202,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable): server['name'] = vm.NAME server['id'] = vm.ID if hasattr(vm.HISTORY_RECORDS, 'HISTORY'): - if isinstance(vm.HISTORY_RECORDS.HISTORY, Sequence) and len(vm.HISTORY_RECORDS.HISTORY) > 0: - if hasattr(vm.HISTORY_RECORDS.HISTORY[-1], 'HOSTNAME'): - server['host'] = vm.HISTORY_RECORDS.HISTORY[-1].HOSTNAME + if isinstance(vm.HISTORY_RECORDS.HISTORY, Sequence) and len(vm.HISTORY_RECORDS.HISTORY) > 0: + if hasattr(vm.HISTORY_RECORDS.HISTORY[-1], 'HOSTNAME'): + 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)