From 09f45498592dc4f905c4c57fe1331d2c4435d517 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Mon, 15 Apr 2024 10:01:09 -0700 Subject: [PATCH] [bp-2.16] facts: Add a generic detection for VMware product name (#83024) * 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 31fa061749a..c368245d32b 100644 --- a/lib/ansible/module_utils/facts/virtual/linux.py +++ b/lib/ansible/module_utils/facts/virtual/linux.py @@ -176,7 +176,7 @@ class LinuxVirtual(Virtual): 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",)): guest_tech.add('VMware') if not found_virt: virtual_facts['virtualization_type'] = 'VMware'