Skip to content

Commit

Permalink
vmware_vm_info: Fix AttributeError
Browse files Browse the repository at this point in the history
  • Loading branch information
mariolenz committed Nov 13, 2023
1 parent 22aa241 commit 7c53e93
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions plugins/modules/vmware_vm_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,12 @@ def get_virtual_machines(self):
net_dict[device.macAddress] = dict()
net_dict[device.macAddress]['ipv4'] = []
net_dict[device.macAddress]['ipv6'] = []
for ip_addr in device.ipConfig.ipAddress:
if "::" in ip_addr.ipAddress:
net_dict[device.macAddress]['ipv6'].append(ip_addr.ipAddress + "/" + str(ip_addr.prefixLength))
else:
net_dict[device.macAddress]['ipv4'].append(ip_addr.ipAddress + "/" + str(ip_addr.prefixLength))
if device.ipConfig is not None:
for ip_addr in device.ipConfig.ipAddress:
if "::" in ip_addr.ipAddress:
net_dict[device.macAddress]['ipv6'].append(ip_addr.ipAddress + "/" + str(ip_addr.prefixLength))
else:
net_dict[device.macAddress]['ipv4'].append(ip_addr.ipAddress + "/" + str(ip_addr.prefixLength))

esxi_hostname = None
esxi_parent = None
Expand Down

0 comments on commit 7c53e93

Please sign in to comment.