SHA256
1
0
forked from pool/salt
salt/add-alibaba-cloud-linux-2-by-backporting-upstream-s-.patch

75 lines
2.6 KiB
Diff
Raw Normal View History

From 2e810cc876f7b7110326231de51d78ff5d12eae6 Mon Sep 17 00:00:00 2001
From: Pau Garcia Quiles <pau.garcia@suse.com>
Date: Tue, 13 Apr 2021 10:31:09 +0200
Subject: [PATCH] Add Alibaba Cloud Linux 2 by backporting upstream's
grain and discarding my own (#352)
---
salt/grains/core.py | 2 ++
tests/unit/grains/test_core.py | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/salt/grains/core.py b/salt/grains/core.py
index 19937f008e..bce8c95179 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",
+ "alibabaclo": "Alinux",
}
# Map the 'os' grain to the 'os_family' grain
@@ -1637,6 +1638,7 @@ _OS_FAMILY_MAP = {
"TurnKey": "Debian",
"Pop": "Debian",
"AstraLinuxCE": "Debian",
+ "Alinux": "RedHat",
}
# Matches any possible format:
diff --git a/tests/unit/grains/test_core.py b/tests/unit/grains/test_core.py
index ac2d515bcd..fa06bb27ab 100644
--- a/tests/unit/grains/test_core.py
+++ b/tests/unit/grains/test_core.py
@@ -846,6 +846,34 @@ class CoreGrainsTestCase(TestCase, LoaderModuleMockMixin):
}
self._run_os_grains_tests("astralinuxce-2.12.22", _os_release_map, expectation)
+ @skipIf(not salt.utils.platform.is_linux(), 'System is not Linux')
+ def test_aliyunlinux2_os_grains(self):
+ '''
+ Test if OS grains are parsed correctly in Alibaba Cloud Linux (Aliyun Linux) 2.1903 LTS
+ '''
+ _os_release_map = {
+ "os_release_file": {
+ "NAME": "Alibaba Cloud Linux (Aliyun Linux)",
+ "VERSION": "2.1903 LTS (Hunting Beagle)",
+ "VERSION_ID": "2.1903",
+ "PRETTY_NAME": "Alibaba Cloud Linux (Aliyun Linux) 2.1903 LTS (Hunting Beagle)",
+ "ID": "alinux",
+ "ANSI_COLOR": "0;31",
+ },
+ "_linux_distribution": ("alinux", "2.1903", "LTS"),
+ }
+ expectation = {
+ "os": "Alinux",
+ "os_family": "RedHat",
+ "oscodename": "Alibaba Cloud Linux (Aliyun Linux) 2.1903 LTS (Hunting Beagle)",
+ "osfullname": "Alibaba Cloud Linux (Aliyun Linux)",
+ "osrelease": "2.1903",
+ "osrelease_info": (2, 1903),
+ "osmajorrelease": 2,
+ "osfinger": "Alibaba Cloud Linux (Aliyun Linux)-2",
+ }
+ self._run_os_grains_tests(None, _os_release_map, expectation)
+
@skipIf(not salt.utils.platform.is_windows(), "System is not Windows")
def test_windows_platform_data(self):
"""
--
2.33.0