SHA256
1
0
forked from pool/salt
salt/adding-preliminary-support-for-rocky.-59682-391.patch

98 lines
3.0 KiB
Diff

From e3e55336b0d457cb55cd83236e9ac8e0dc671d2e Mon Sep 17 00:00:00 2001
From: Victor Zhestkov <35733135+vzhestkov@users.noreply.github.com>
Date: Mon, 5 Jul 2021 18:57:26 +0300
Subject: [PATCH] Adding preliminary support for Rocky. (#59682) (#391)
* Adding preliminary support for Rocky.
* Adding changelog and test per MR guidence.
* Update test_core.py
Fix a clean up issue
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
Co-authored-by: StackKorora <42156355+StackKorora@users.noreply.github.com>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
---
changelog/59682.added | 1 +
salt/grains/core.py | 2 ++
tests/unit/grains/test_core.py | 29 +++++++++++++++++++++++++++++
3 files changed, 32 insertions(+)
create mode 100644 changelog/59682.added
diff --git a/changelog/59682.added b/changelog/59682.added
new file mode 100644
index 0000000000..93b4a3d1fc
--- /dev/null
+++ b/changelog/59682.added
@@ -0,0 +1 @@
+Rocky Linux has been added to the RedHat os_family.
diff --git a/salt/grains/core.py b/salt/grains/core.py
index bce8c95179..f79110124f 100644
--- a/salt/grains/core.py
+++ b/salt/grains/core.py
@@ -1560,6 +1560,7 @@ _OS_NAME_MAP = {
"linuxmint": "Mint",
"neon": "KDE neon",
"pop": "Pop",
+ "rocky": "Rocky",
"alibabaclo": "Alinux",
}
@@ -1637,6 +1638,7 @@ _OS_FAMILY_MAP = {
"AIX": "AIX",
"TurnKey": "Debian",
"Pop": "Debian",
+ "Rocky": "RedHat",
"AstraLinuxCE": "Debian",
"Alinux": "RedHat",
}
diff --git a/tests/unit/grains/test_core.py b/tests/unit/grains/test_core.py
index fa06bb27ab..fcc7586775 100644
--- a/tests/unit/grains/test_core.py
+++ b/tests/unit/grains/test_core.py
@@ -708,6 +708,35 @@ class CoreGrainsTestCase(TestCase, LoaderModuleMockMixin):
}
self._run_os_grains_tests(None, _os_release_map, expectation)
+ @skipIf(not salt.utils.platform.is_linux(), "System is not Linux")
+ def test_rocky_8_os_grains(self):
+ """
+ Test if OS grains are parsed correctly in Rocky 8
+ """
+ _os_release_map = {
+ "os_release_file": {
+ "NAME": "Rocky",
+ "VERSION_ID": "8.3",
+ "PRETTY_NAME": "Rocky 8",
+ "ID": "Rocky",
+ "ANSI_COLOR": "0;31",
+ "CPE_NAME": "cpe:/o:rocky:rocky:8.3",
+ },
+ "_linux_distribution": ("rocky", "8.3", ""),
+ }
+
+ expectation = {
+ "os": "Rocky",
+ "os_family": "RedHat",
+ "oscodename": "Rocky 8",
+ "osfullname": "Rocky",
+ "osrelease": "8.3",
+ "osrelease_info": (8, 3,),
+ "osmajorrelease": 8,
+ "osfinger": "Rocky-8",
+ }
+ self._run_os_grains_tests(None, _os_release_map, expectation)
+
@skipIf(not salt.utils.platform.is_linux(), "System is not Linux")
def test_almalinux_8_os_grains(self):
"""
--
2.33.0