summaryrefslogtreecommitdiff
path: root/cloudinit/tests
diff options
context:
space:
mode:
authorAndrew Lukoshko <andrew.lukoshko@gmail.com>2021-05-08 00:31:14 +0300
committerGitHub <noreply@github.com>2021-05-07 16:31:14 -0500
commit8cf40a73646a9448746fc4043c6410ae92172e7c (patch)
tree1f807d522ce7ebe84e295697310a63cb86651498 /cloudinit/tests
parent13877549527812959f59e4add685bc42d350edd8 (diff)
downloadvyos-cloud-init-8cf40a73646a9448746fc4043c6410ae92172e7c.tar.gz
vyos-cloud-init-8cf40a73646a9448746fc4043c6410ae92172e7c.zip
Add AlmaLinux OS support (#872)
AlmaLinux OS is RHEL-compatible so all the changes needed are trivial.
Diffstat (limited to 'cloudinit/tests')
-rw-r--r--cloudinit/tests/test_util.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/cloudinit/tests/test_util.py b/cloudinit/tests/test_util.py
index e811917e..a4c02877 100644
--- a/cloudinit/tests/test_util.py
+++ b/cloudinit/tests/test_util.py
@@ -107,12 +107,31 @@ OS_RELEASE_REDHAT_7 = dedent("""\
REDHAT_SUPPORT_PRODUCT_VERSION="7.5"
""")
+OS_RELEASE_ALMALINUX_8 = dedent("""\
+ NAME="AlmaLinux"
+ VERSION="8.3 (Purple Manul)"
+ ID="almalinux"
+ ID_LIKE="rhel centos fedora"
+ VERSION_ID="8.3"
+ PLATFORM_ID="platform:el8"
+ PRETTY_NAME="AlmaLinux 8.3 (Purple Manul)"
+ ANSI_COLOR="0;34"
+ CPE_NAME="cpe:/o:almalinux:almalinux:8.3:GA"
+ HOME_URL="https://almalinux.org/"
+ BUG_REPORT_URL="https://bugs.almalinux.org/"
+
+ ALMALINUX_MANTISBT_PROJECT="AlmaLinux-8"
+ ALMALINUX_MANTISBT_PROJECT_VERSION="8.3"
+""")
+
REDHAT_RELEASE_CENTOS_6 = "CentOS release 6.10 (Final)"
REDHAT_RELEASE_CENTOS_7 = "CentOS Linux release 7.5.1804 (Core)"
REDHAT_RELEASE_REDHAT_6 = (
"Red Hat Enterprise Linux Server release 6.10 (Santiago)")
REDHAT_RELEASE_REDHAT_7 = (
"Red Hat Enterprise Linux Server release 7.5 (Maipo)")
+REDHAT_RELEASE_ALMALINUX_8 = (
+ "AlmaLinux release 8.3 (Purple Manul)")
OS_RELEASE_DEBIAN = dedent("""\
@@ -503,6 +522,22 @@ class TestGetLinuxDistro(CiTestCase):
self.assertEqual(('centos', '7', 'Core'), dist)
@mock.patch('cloudinit.util.load_file')
+ def test_get_linux_almalinux8_rhrelease(self, m_os_release, m_path_exists):
+ """Verify almalinux 8 read from redhat-release."""
+ m_os_release.return_value = REDHAT_RELEASE_ALMALINUX_8
+ m_path_exists.side_effect = TestGetLinuxDistro.redhat_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('almalinux', '8.3', 'Purple Manul'), dist)
+
+ @mock.patch('cloudinit.util.load_file')
+ def test_get_linux_almalinux8_osrelease(self, m_os_release, m_path_exists):
+ """Verify almalinux 8 read from os-release."""
+ m_os_release.return_value = OS_RELEASE_ALMALINUX_8
+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('almalinux', '8.3', 'Purple Manul'), dist)
+
+ @mock.patch('cloudinit.util.load_file')
def test_get_linux_debian(self, m_os_release, m_path_exists):
"""Verify we get the correct name and release name on Debian."""
m_os_release.return_value = OS_RELEASE_DEBIAN