1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add 'mac_address' to the attributes returned from the vmware_vm_facts module (#26527)

* Add 'mac_address' to the attributes returned from the vmware_vm_facts module

* fix pep8 issue
This commit is contained in:
Gawain 2017-07-14 22:25:20 +08:00 committed by jctanner
parent ca5439e1e2
commit 6608629d25

View file

@ -68,12 +68,17 @@ def get_all_virtual_machines(content):
_ip_address = summary.guest.ipAddress _ip_address = summary.guest.ipAddress
if _ip_address is None: if _ip_address is None:
_ip_address = "" _ip_address = ""
_mac_address = []
for dev in vm.config.hardware.device:
if isinstance(dev, vim.vm.device.VirtualEthernetCard):
_mac_address.append(dev.macAddress)
virtual_machine = { virtual_machine = {
summary.config.name: { summary.config.name: {
"guest_fullname": summary.config.guestFullName, "guest_fullname": summary.config.guestFullName,
"power_state": summary.runtime.powerState, "power_state": summary.runtime.powerState,
"ip_address": _ip_address, "ip_address": _ip_address,
"mac_address": _mac_address,
"uuid": summary.config.uuid "uuid": summary.config.uuid
} }
} }