2021-09-27 12:08:32 +02:00
|
|
|
From 2e810cc876f7b7110326231de51d78ff5d12eae6 Mon Sep 17 00:00:00 2001
|
2021-04-13 17:36:55 +02:00
|
|
|
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)
|
|
|
|
|
|
|
|
---
|
2021-09-27 12:08:32 +02:00
|
|
|
salt/grains/core.py | 2 ++
|
|
|
|
tests/unit/grains/test_core.py | 28 ++++++++++++++++++++++++++++
|
|
|
|
2 files changed, 30 insertions(+)
|
2021-04-13 17:36:55 +02:00
|
|
|
|
|
|
|
diff --git a/salt/grains/core.py b/salt/grains/core.py
|
2021-09-27 12:08:32 +02:00
|
|
|
index 19937f008e..bce8c95179 100644
|
2021-04-13 17:36:55 +02:00
|
|
|
--- a/salt/grains/core.py
|
|
|
|
+++ b/salt/grains/core.py
|
2021-09-27 12:08:32 +02:00
|
|
|
@@ -1560,6 +1560,7 @@ _OS_NAME_MAP = {
|
2021-04-13 17:36:55 +02:00
|
|
|
"linuxmint": "Mint",
|
|
|
|
"neon": "KDE neon",
|
2021-09-27 12:08:32 +02:00
|
|
|
"pop": "Pop",
|
2021-04-13 17:36:55 +02:00
|
|
|
+ "alibabaclo": "Alinux",
|
|
|
|
}
|
|
|
|
|
|
|
|
# Map the 'os' grain to the 'os_family' grain
|
2021-09-27 12:08:32 +02:00
|
|
|
@@ -1637,6 +1638,7 @@ _OS_FAMILY_MAP = {
|
2021-04-13 17:36:55 +02:00
|
|
|
"TurnKey": "Debian",
|
2021-09-27 12:08:32 +02:00
|
|
|
"Pop": "Debian",
|
2021-04-13 17:36:55 +02:00
|
|
|
"AstraLinuxCE": "Debian",
|
|
|
|
+ "Alinux": "RedHat",
|
|
|
|
}
|
|
|
|
|
|
|
|
# Matches any possible format:
|
|
|
|
diff --git a/tests/unit/grains/test_core.py b/tests/unit/grains/test_core.py
|
2021-09-27 12:08:32 +02:00
|
|
|
index ac2d515bcd..fa06bb27ab 100644
|
2021-04-13 17:36:55 +02:00
|
|
|
--- a/tests/unit/grains/test_core.py
|
|
|
|
+++ b/tests/unit/grains/test_core.py
|
2021-09-27 12:08:32 +02:00
|
|
|
@@ -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 = {
|
2021-04-13 17:36:55 +02:00
|
|
|
+ "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"),
|
2021-09-27 12:08:32 +02:00
|
|
|
+ }
|
|
|
|
+ expectation = {
|
2021-04-13 17:36:55 +02:00
|
|
|
+ "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",
|
2021-09-27 12:08:32 +02:00
|
|
|
+ }
|
|
|
|
+ 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):
|
|
|
|
"""
|
2021-04-13 17:36:55 +02:00
|
|
|
--
|
2021-09-27 12:08:32 +02:00
|
|
|
2.33.0
|
2021-04-13 17:36:55 +02:00
|
|
|
|
|
|
|
|