File add-almalinux-to-the-os-family-list-340.patch of Package salt

From 9078f801a22deacd4b2afa98d89e159cb5956058 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julio=20Gonz=C3=A1lez=20Gil?=
 <juliogonzalez@users.noreply.github.com>
Date: Wed, 24 Mar 2021 14:11:50 +0100
Subject: [PATCH] Add AlmaLinux to the OS Family list (#340)

---
 salt/grains/core.py            |  2 ++
 tests/unit/grains/test_core.py | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/salt/grains/core.py b/salt/grains/core.py
index 38290d034a..07fe25556a 100644
--- a/salt/grains/core.py
+++ b/salt/grains/core.py
@@ -1453,6 +1453,7 @@ _OS_NAME_MAP = {
     'oracleserv': 'OEL',
     'cloudserve': 'CloudLinux',
     'cloudlinux': 'CloudLinux',
+    'almalinux': 'AlmaLinux',
     'pidora': 'Fedora',
     'scientific': 'ScientificLinux',
     'synology': 'Synology',
@@ -1484,6 +1485,7 @@ _OS_FAMILY_MAP = {
     'Scientific': 'RedHat',
     'Amazon': 'RedHat',
     'CloudLinux': 'RedHat',
+    'AlmaLinux': 'RedHat',
     'OVS': 'RedHat',
     'OEL': 'RedHat',
     'XCP': 'RedHat',
diff --git a/tests/unit/grains/test_core.py b/tests/unit/grains/test_core.py
index 1a819ec348..3f3b578f05 100644
--- a/tests/unit/grains/test_core.py
+++ b/tests/unit/grains/test_core.py
@@ -568,6 +568,27 @@ class CoreGrainsTestCase(TestCase, LoaderModuleMockMixin):
         }
         self._run_os_grains_tests("debian-9", _os_release_map, expectation)
 
+    @skipIf(not salt.utils.platform.is_linux(), 'System is not Linux')
+    def test_almalinux_8_os_grains(self):
+        '''
+        Test if OS grains are parsed correctly in AlmaLinux 8
+        '''
+        _os_release_map = {
+            'linux_distribution': ('AlmaLinux', '8.3', 'Purple Manul'),
+        }
+
+        expectation = {
+            'os': 'AlmaLinux',
+            'os_family': 'RedHat',
+            'oscodename': 'Purple Manul',
+            'osfullname': 'AlmaLinux',
+            'osrelease': '8.3',
+            'osrelease_info': (8, 3,),
+            'osmajorrelease': 8,
+            'osfinger': 'AlmaLinux-8',
+        }
+        self._run_os_grains_tests(None, _os_release_map, expectation)
+
     @skipIf(not salt.utils.platform.is_linux(), 'System is not Linux')
     def test_ubuntu_xenial_os_grains(self):
         '''
-- 
2.30.2
openSUSE Build Service is sponsored by