mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-07 19:23:09 +00:00
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:
committed by
Sam Doran
parent
c05a7add5f
commit
4034630625
@@ -72,9 +72,10 @@ def get_all_virtual_machines(content):
|
||||
if _ip_address is None:
|
||||
_ip_address = ""
|
||||
_mac_address = []
|
||||
for dev in vm.config.hardware.device:
|
||||
if isinstance(dev, vim.vm.device.VirtualEthernetCard):
|
||||
_mac_address.append(dev.macAddress)
|
||||
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)
|
||||
|
||||
virtual_machine = {
|
||||
summary.config.name: {
|
||||
|
||||
Reference in New Issue
Block a user