From 6404c6484ce14ed60b8bf2d10414d4c681e644db Mon Sep 17 00:00:00 2001 From: jokurz Date: Wed, 28 Nov 2018 01:43:07 +0100 Subject: [PATCH] Fix fact ansible_distribution_version for AIX (#48570) * Fix fact ansible_distribution_version for AIX * aix_facts: Check oslevel output --- lib/ansible/module_utils/facts/system/distribution.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/facts/system/distribution.py b/lib/ansible/module_utils/facts/system/distribution.py index 6ee8e3a2894..be565388b09 100644 --- a/lib/ansible/module_utils/facts/system/distribution.py +++ b/lib/ansible/module_utils/facts/system/distribution.py @@ -503,8 +503,11 @@ class Distribution(object): rc, out, err = self.module.run_command("/usr/bin/oslevel") data = out.split('.') aix_facts['distribution_major_version'] = data[0] - aix_facts['distribution_version'] = data[0] - aix_facts['distribution_release'] = data[1] + if len(data) > 1: + aix_facts['distribution_version'] = '%s.%s' % (data[0], data[1]) + aix_facts['distribution_release'] = data[1] + else: + aix_facts['distribution_version'] = data[0] return aix_facts def get_distribution_HPUX(self):