From 173091e2e36d38c978002990795f66cfc0af30ad Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Tue, 15 Sep 2020 19:17:24 +0530 Subject: [PATCH] distro: Add support for Pardus distribution (#71663) Fixes: #71636 Signed-off-by: Abhijeet Kasurde --- changelogs/fragments/71636_distro.yml | 2 + .../module_utils/facts/system/distribution.py | 2 +- lib/ansible/modules/hostname.py | 6 +++ .../distribution/fixtures/pardus_19.1.json | 41 +++++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/71636_distro.yml create mode 100644 test/units/module_utils/facts/system/distribution/fixtures/pardus_19.1.json diff --git a/changelogs/fragments/71636_distro.yml b/changelogs/fragments/71636_distro.yml new file mode 100644 index 00000000000..3753d3f1672 --- /dev/null +++ b/changelogs/fragments/71636_distro.yml @@ -0,0 +1,2 @@ +bugfixes: +- distribution - add support for Pardus Linux distribution (https://github.com/ansible/ansible/issues/71636). diff --git a/lib/ansible/module_utils/facts/system/distribution.py b/lib/ansible/module_utils/facts/system/distribution.py index 8ad69ec079a..1665420db54 100644 --- a/lib/ansible/module_utils/facts/system/distribution.py +++ b/lib/ansible/module_utils/facts/system/distribution.py @@ -491,7 +491,7 @@ class Distribution(object): 'EulerOS', 'openEuler'], 'Debian': ['Debian', 'Ubuntu', 'Raspbian', 'Neon', 'KDE neon', 'Linux Mint', 'SteamOS', 'Devuan', 'Kali', 'Cumulus Linux', - 'Pop!_OS', 'Parrot'], + 'Pop!_OS', 'Parrot', 'Pardus GNU/Linux'], 'Suse': ['SuSE', 'SLES', 'SLED', 'openSUSE', 'openSUSE Tumbleweed', 'SLES_SAP', 'SUSE_LINUX', 'openSUSE Leap'], 'Archlinux': ['Archlinux', 'Antergos', 'Manjaro'], diff --git a/lib/ansible/modules/hostname.py b/lib/ansible/modules/hostname.py index 5be952af4e2..af6fe23d581 100644 --- a/lib/ansible/modules/hostname.py +++ b/lib/ansible/modules/hostname.py @@ -826,6 +826,12 @@ class OsmcHostname(Hostname): strategy_class = SystemdStrategy +class PardusHostname(Hostname): + platform = 'Linux' + distribution = 'Pardus' + strategy_class = SystemdStrategy + + class VoidLinuxHostname(Hostname): platform = 'Linux' distribution = 'Void' diff --git a/test/units/module_utils/facts/system/distribution/fixtures/pardus_19.1.json b/test/units/module_utils/facts/system/distribution/fixtures/pardus_19.1.json new file mode 100644 index 00000000000..daf8f6e3d86 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/pardus_19.1.json @@ -0,0 +1,41 @@ +{ + "name": "Pardus GNU/Linux 19.1", + "distro": { + "codename": "ondokuz", + "id": "pradus", + "name": "Pardus GNU/Linux", + "version": "19.1", + "version_best": "19.1", + "lsb_release_info": { + "release": "19.1", + "codename": "ondokuz", + "distributor_id": "Pardus", + "description": "Pardus GNU/Linux Ondokuz" + }, + "os_release_info": { + "pardus_codename": "ondokuz", + "name": "Pardus GNU/Linux", + "version_codename": "ondokuz", + "id_like": "debian", + "version_id": "19.1", + "bug_report_url": "https://talep.pardus.org.tr/", + "pretty_name": "Pardus GNU/Linux Ondokuz", + "version": "19.1 (Ondokuz)", + "codename": "ondokuz", + "home_url": "https://www.pardus.org.tr/", + "id": "pardus", + "support_url": "https://forum.pardus.org.tr/" + } + }, + "input": { + "/etc/os-release": "NAME=\"Pardus GNU/Linux\"\nVERSION=\"19.1 (Ondokuz)\"\nID=pardus\nID_LIKE=debian\nPRETTY_NAME=\"Pardus GNU/Linux Ondokuz\"\nVERSION_ID=\"19.1\"\nHOME_URL=\"https://www.pardus.org.tr/\"\nSUPPORT_URL=\"https://forum.pardus.org.tr/\"\nBUG_REPORT_URL=\"https://talep.pardus.org.tr/\"\nVERSION_CODENAME=ondokuz\nPARDUS_CODENAME=ondokuz" + }, + "platform.dist": ["debian", "10.0", ""], + "result": { + "distribution": "Pardus GNU/Linux", + "distribution_version": "19.1", + "distribution_release": "ondokuz", + "distribution_major_version": "19", + "os_family": "Debian" + } +} \ No newline at end of file