Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty hardware version in collected OVF config info and guest_info.json #497

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/collect_ovf_vm_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
ovf_vm_hardware_config |
combine({'Guest OS ID': vm_config.config.guestId | default(''),
'Guest OS Version': vm_config.config.guestFullName | default(''),
'Hardware Version': vm_hardware_version | default(''),
'Hardware Version': vm_config.config.version | default(''),
'CPU Number': vm_config.config.hardware.numCPU | default(''),
'CPU Cores per Socket': vm_config.config.hardware.numCoresPerSocket | default(''),
'CPU Hot Add Enabled': vm_config.config.cpuHotAddEnabled | default(''),
Expand Down
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