vmware_vm_facts: Add error check for config.vm (#31629)

Add a simple check to see if vm.config exists before looking for
vm.config.hardware
This commit is contained in:
Zubair Lutfullah Kakakhel 2017-10-12 15:32:06 +01:00 committed by Sam Doran
parent c05a7add5f
commit 4034630625

View file

@ -72,6 +72,7 @@ def get_all_virtual_machines(content):
if _ip_address is None:
_ip_address = ""
_mac_address = []
if vm.config is not None:
for dev in vm.config.hardware.device:
if isinstance(dev, vim.vm.device.VirtualEthernetCard):
_mac_address.append(dev.macAddress)