From 37be99c617429df783bdacfdefe888fbe93a277e Mon Sep 17 00:00:00 2001 From: Ricardo Bartels Date: Thu, 2 Sep 2021 22:10:31 +0200 Subject: [PATCH] fixes issues with insufficient data #80, #81 refs: #80 refs: #81 --- module/sources/vmware/connection.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/module/sources/vmware/connection.py b/module/sources/vmware/connection.py index 7fc76e4..605d7a3 100644 --- a/module/sources/vmware/connection.py +++ b/module/sources/vmware/connection.py @@ -1046,6 +1046,9 @@ def add_device_vm_to_inventory(self, object_type, object_data, site_name, pnic_d # map interfaces of existing object with discovered interfaces nic_object_dict = self.map_object_interfaces_to_current_interfaces(device_vm_object, nic_data) + if object_data.get("status", "") == "active" and (nic_ips is None or len(nic_ips.keys()) == 0): + log.warning(f"No IP addresses for '{object_name}' found!") + for int_name, int_data in nic_data.items(): # add object to interface @@ -1618,7 +1621,11 @@ def add_host(self, obj): log.debug2(f"Found host portGroup {pgroup_name}") nic_order = grab(pgroup, "computedPolicy.nicTeaming.nicOrder") - pgroup_nics = nic_order.activeNic + nic_order.standbyNic + pgroup_nics = list() + if nic_order.activeNic is not None: + pgroup_nics += nic_order.activeNic + if nic_order.standbyNic is not None: + pgroup_nics += nic_order.standbyNic self.network_data["host_pgroup"][name][pgroup_name] = { "vlan_id": grab(pgroup, "spec.vlanId"),