From 6dba96c8cc6672a71771cab6152f519e6c56cb0e Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Tue, 4 Sep 2018 18:08:57 +0530 Subject: [PATCH] Added changelog after review --- .../49123-backport-devuan-support.yml | 2 ++ .../module_utils/facts/system/distribution.py | 11 +++++++++- .../module_utils/test_distribution_version.py | 22 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/49123-backport-devuan-support.yml diff --git a/changelogs/fragments/49123-backport-devuan-support.yml b/changelogs/fragments/49123-backport-devuan-support.yml new file mode 100644 index 00000000000..d1243f0f2f7 --- /dev/null +++ b/changelogs/fragments/49123-backport-devuan-support.yml @@ -0,0 +1,2 @@ +bugfixes: + - Backported support for Devuan-based distribution diff --git a/lib/ansible/module_utils/facts/system/distribution.py b/lib/ansible/module_utils/facts/system/distribution.py index 80b131aa08c..3f15f7c6451 100644 --- a/lib/ansible/module_utils/facts/system/distribution.py +++ b/lib/ansible/module_utils/facts/system/distribution.py @@ -315,6 +315,15 @@ class DistributionFiles: elif 'SteamOS' in data: debian_facts['distribution'] = 'SteamOS' # nothing else to do, SteamOS gets correct info from python functions + elif 'Devuan' in data: + debian_facts['distribution'] = 'Devuan' + release = re.search(r"PRETTY_NAME=[^(]+ \(?([^)]+?)\)", data) + if release: + debian_facts['distribution_release'] = release.groups()[0] + version = re.search(r"VERSION_ID=\"(.*)\"", data) + if version: + debian_facts['distribution_version'] = version.group(1) + debian_facts['distribution_major_version'] = version.group(1) else: return False, debian_facts @@ -414,7 +423,7 @@ class Distribution(object): 'Ascendos', 'CloudLinux', 'PSBM', 'OracleLinux', 'OVS', 'OEL', 'Amazon', 'Virtuozzo', 'XenServer'], 'Debian': ['Debian', 'Ubuntu', 'Raspbian', 'Neon', 'KDE neon', - 'Linux Mint', 'SteamOS'], + 'Linux Mint', 'SteamOS', 'Devuan'], 'Suse': ['SuSE', 'SLES', 'SLED', 'openSUSE', 'openSUSE Tumbleweed', 'SLES_SAP', 'SUSE_LINUX', 'openSUSE Leap'], 'Archlinux': ['Archlinux', 'Antergos', 'Manjaro'], diff --git a/test/units/module_utils/test_distribution_version.py b/test/units/module_utils/test_distribution_version.py index ca3c8016515..25f9169593a 100644 --- a/test/units/module_utils/test_distribution_version.py +++ b/test/units/module_utils/test_distribution_version.py @@ -427,6 +427,28 @@ DISTRIB_DESCRIPTION="SteamOS 2.0" 'distribution_version': u'2.0' } }, + { + 'name': "Devuan", + 'input': { + '/etc/os-release': """PRETTY_NAME="Devuan GNU/Linux 1 (jessie)" +NAME="Devuan GNU/Linux" +VERSION_ID="1" +VERSION="1 (jessie)" +ID=devuan +HOME_URL="http://www.devuan.org/" +SUPPORT_URL="http://www.devuan.org/support/" +BUG_REPORT_URL="https://bugs.devuan.org/" +""" + }, + 'platform.dist': ('', '', ''), + 'result': { + 'distribution': u'Devuan', + 'distribution_major_version': u'1', + 'distribution_release': u'jessie', + 'os_family': 'Debian', + 'distribution_version': u'1' + } + }, { "platform.dist": [ "Ubuntu",