From cb818011246c430458588cd393fc540c51e8b6d2 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Thu, 11 Apr 2024 12:07:36 -0700 Subject: [PATCH] facts: Add a generic detection for VMware product name (#83012) * Use startswith instead of hardcoded values in VMWare product detction Signed-off-by: Abhijeet Kasurde --- changelogs/fragments/vmware_facts.yml | 3 +++ lib/ansible/module_utils/facts/virtual/linux.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/vmware_facts.yml diff --git a/changelogs/fragments/vmware_facts.yml b/changelogs/fragments/vmware_facts.yml new file mode 100644 index 00000000000..257fe90c3fb --- /dev/null +++ b/changelogs/fragments/vmware_facts.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - facts - add a generic detection for VMware in product name. diff --git a/lib/ansible/module_utils/facts/virtual/linux.py b/lib/ansible/module_utils/facts/virtual/linux.py index 05ae1254ca0..57b047b11a1 100644 --- a/lib/ansible/module_utils/facts/virtual/linux.py +++ b/lib/ansible/module_utils/facts/virtual/linux.py @@ -175,7 +175,7 @@ class LinuxVirtual(Virtual): virtual_facts['virtualization_type'] = 'RHEV' found_virt = True - if product_name in ('VMware Virtual Platform', 'VMware7,1', 'VMware20,1'): + if product_name and product_name.startswith(("VMware",)): guest_tech.add('VMware') if not found_virt: virtual_facts['virtualization_type'] = 'VMware'