add aliyun linux support and set alinux as redhat family

Signed-off-by: Chunmei Xu <xuchunmei@linux.alibaba.com>
This commit is contained in:
Chunmei Xu 2021-03-03 16:05:11 +08:00 committed by Megan Wilhite
parent 0b5a3536c5
commit 3f3010415d
3 changed files with 32 additions and 0 deletions

1
changelog/59686.fixed Normal file
View file

@ -0,0 +1 @@
add aliyun linux support and set alinux as redhat family

View file

@ -1558,6 +1558,7 @@ _OS_NAME_MAP = {
"linuxmint": "Mint",
"neon": "KDE neon",
"pop": "Pop",
"alibabaclo": "Alinux",
}
# Map the 'os' grain to the 'os_family' grain
@ -1634,6 +1635,7 @@ _OS_FAMILY_MAP = {
"AIX": "AIX",
"TurnKey": "Debian",
"Pop": "Debian",
"Alinux": "RedHat",
}
# Matches any possible format:

View file

@ -677,6 +677,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_alinux2_os_grains(self):
"""
Test if OS grains are parsed correctly in Alibaba Cloud Linux
"""
_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_linux(), "System is not Linux")
def test_centos_stream_8_os_grains(self):
"""