From b2cde3a8964373d51d24e66692394d98858a2b33 Mon Sep 17 00:00:00 2001 From: Mahesh Date: Wed, 13 Jul 2022 21:30:13 +0200 Subject: [PATCH] =?UTF-8?q?Add=20default=20value=20for=20lvm=5Ffacts=20whe?= =?UTF-8?q?n=20lvm=20or=20lvm2=20is=20not=20installed=20or=20=E2=80=A6=20(?= =?UTF-8?q?#75989)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add default value for lvm_facts when lvm or lvm2 is not installed or there are no lvm facts --- changelogs/fragments/17393-fix_silently_failing_lvm_facts.yaml | 2 ++ lib/ansible/module_utils/facts/hardware/linux.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/17393-fix_silently_failing_lvm_facts.yaml diff --git a/changelogs/fragments/17393-fix_silently_failing_lvm_facts.yaml b/changelogs/fragments/17393-fix_silently_failing_lvm_facts.yaml new file mode 100644 index 00000000000..3d5dc0ad612 --- /dev/null +++ b/changelogs/fragments/17393-fix_silently_failing_lvm_facts.yaml @@ -0,0 +1,2 @@ +bugfixes: + - setup - Adds a default value to ``lvm_facts`` when lvm or lvm2 is not installed on linux (https://github.com/ansible/ansible/issues/17393) diff --git a/lib/ansible/module_utils/facts/hardware/linux.py b/lib/ansible/module_utils/facts/hardware/linux.py index 39ed62a5a9c..c0ca33d5b31 100644 --- a/lib/ansible/module_utils/facts/hardware/linux.py +++ b/lib/ansible/module_utils/facts/hardware/linux.py @@ -818,7 +818,7 @@ class LinuxHardware(Hardware): def get_lvm_facts(self): """ Get LVM Facts if running as root and lvm utils are available """ - lvm_facts = {} + lvm_facts = {'lvm': 'N/A'} if os.getuid() == 0 and self.module.get_bin_path('vgs'): lvm_util_options = '--noheadings --nosuffix --units g --separator ,'