File adding-preliminary-support-for-rocky.-59682-391.patch of Package salt

From 34a913b0b54b55edf042dc899250e56ef0eaec77 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 2b965a2a8a..ace0e4bff9 100644
--- a/salt/grains/core.py
+++ b/salt/grains/core.py
@@ -1547,6 +1547,7 @@ _OS_NAME_MAP = {
     "slesexpand": "RES",
     "linuxmint": "Mint",
     "neon": "KDE neon",
+    "rocky": "Rocky",
     "alibabaclo": "Alinux",
 }
 
@@ -1621,6 +1622,7 @@ _OS_FAMILY_MAP = {
     "Funtoo": "Gentoo",
     "AIX": "AIX",
     "TurnKey": "Debian",
+    "Rocky": "RedHat",
     "AstraLinuxCE": "Debian",
     "Alinux": "RedHat",
 }
diff --git a/tests/unit/grains/test_core.py b/tests/unit/grains/test_core.py
index 8280d6de47..61a6956e32 100644
--- a/tests/unit/grains/test_core.py
+++ b/tests/unit/grains/test_core.py
@@ -678,6 +678,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.32.0


openSUSE Build Service is sponsored by