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

[stable-2.15] facts: Add a generic detection for VMware product name #83109

Merged
merged 1 commit into from May 9, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/vmware_facts.yml
@@ -0,0 +1,3 @@
---
bugfixes:
- facts - add a generic detection for VMware in product name.
2 changes: 1 addition & 1 deletion lib/ansible/module_utils/facts/virtual/linux.py
Expand Up @@ -176,7 +176,7 @@ def get_virtual_facts(self):
virtual_facts['virtualization_type'] = 'RHEV'
found_virt = True

if product_name in ('VMware Virtual Platform', 'VMware7,1'):
if product_name and product_name.startswith(("VMware",)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the passed value doesn't need to be a tuple of strings if there's just one string.

Suggested change
if product_name and product_name.startswith(("VMware",)):
if product_name and product_name.startswith("VMware"):

would do the same but looks cleaner

guest_tech.add('VMware')
if not found_virt:
virtual_facts['virtualization_type'] = 'VMware'
Expand Down