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:
parent
c05a7add5f
commit
4034630625
1 changed files with 4 additions and 3 deletions
|
@ -72,9 +72,10 @@ def get_all_virtual_machines(content):
|
||||||
if _ip_address is None:
|
if _ip_address is None:
|
||||||
_ip_address = ""
|
_ip_address = ""
|
||||||
_mac_address = []
|
_mac_address = []
|
||||||
for dev in vm.config.hardware.device:
|
if vm.config is not None:
|
||||||
if isinstance(dev, vim.vm.device.VirtualEthernetCard):
|
for dev in vm.config.hardware.device:
|
||||||
_mac_address.append(dev.macAddress)
|
if isinstance(dev, vim.vm.device.VirtualEthernetCard):
|
||||||
|
_mac_address.append(dev.macAddress)
|
||||||
|
|
||||||
virtual_machine = {
|
virtual_machine = {
|
||||||
summary.config.name: {
|
summary.config.name: {
|
||||||
|
|
Loading…
Reference in a new issue