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

VMware: fix hw_guest_ha_state fact (#33318)

Set  hw_guest_ha_state as None if `vm.summary.runtime.dasVmProtection` isn't printable/json-able. So if vm.summary.runtime.dasVmProtection is defined, return
vm.summary.runtime.dasVmProtection.dasProtected.
This commit is contained in:
tchernomax 2017-11-29 05:14:23 +01:00 committed by Abhijeet Kasurde
parent ef37a7fbd6
commit 6732be3e62

View file

@ -280,7 +280,7 @@ def gather_vm_facts(content, vm):
'hw_datastores': [],
'hw_files': [],
'hw_esxi_host': None,
'hw_guest_ha_state': vm.summary.runtime.dasVmProtection,
'hw_guest_ha_state': None,
'hw_is_template': vm.config.template,
'hw_folder': None,
'guest_tools_status': _get_vm_prop(vm, ('guest', 'toolsRunningStatus')),
@ -299,6 +299,8 @@ def gather_vm_facts(content, vm):
if vm.summary.runtime.host:
host = vm.summary.runtime.host
facts['hw_esxi_host'] = host.summary.config.name
if vm.summary.runtime.dasVmProtection:
facts['hw_guest_ha_state'] = vm.summary.runtime.dasVmProtection.dasProtected
datastores = vm.datastore
for ds in datastores: