Skip to content

Commit

Permalink
Fix empty hardware version in collected guest info
Browse files Browse the repository at this point in the history
Signed-off-by: Qi Zhang <qiz@vmware.com>
  • Loading branch information
keirazhang committed Sep 4, 2023
1 parent 133c7de commit 798a6b9
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions plugin/ansible_vsphere_gosv_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,16 +924,18 @@ def _collect_ansible_gosv_facts(self, result):
self._last_test_id in self.test_runs):
# Update deploy_vm test case name
self.test_runs[self._last_test_id].name = non_empty_facts['current_testcase_name']
elif task_file == "vm_get_guest_info.yml":

if (self._ansible_gosv_facts.get('esxi_build','') and
self._ansible_gosv_facts.get('vm_hardware_version','') and
self._ansible_gosv_facts.get('guestinfo_vmtools_info', ''):
# Save guest info
vm_guest_info = VmGuestInfo(self._ansible_gosv_facts)
if vm_guest_info.VMTools_Version:
guestinfo_hash = str(hash("{}{}{}".format(vm_guest_info.ESXi_Build,
vm_guest_info.VMTools_Version,
vm_guest_info.Hardware_Version)))
guestinfo_hash = str(hash("{}{}{}".format(vm_guest_info.ESXi_Build,
vm_guest_info.VMTools_Version,
vm_guest_info.Hardware_Version)))

if guestinfo_hash not in self.collected_guest_info:
self.collected_guest_info[guestinfo_hash] = vm_guest_info
if guestinfo_hash not in self.collected_guest_info:
self.collected_guest_info[guestinfo_hash] = vm_guest_info

elif (task_file in ["deploy_vm.yml", "test_setup.yml"] and
str(task.action) == "ansible.builtin.debug"):
Expand Down

0 comments on commit 798a6b9

Please sign in to comment.