summaryrefslogtreecommitdiff
path: root/cloudinit/tests
diff options
context:
space:
mode:
authorAlexandr Kravchenko <sasha121196@mail.ru>2021-09-01 22:01:09 +0300
committerGitHub <noreply@github.com>2021-09-01 14:01:09 -0500
commitf6c71fd758a3589ac5f62fd251d60b00edf5bb1c (patch)
treef1c176794a4c700ea8b6a0e745360c493e373050 /cloudinit/tests
parentdb72c841c2ec0d94d366df7fa623e82e91e2201c (diff)
downloadvyos-cloud-init-f6c71fd758a3589ac5f62fd251d60b00edf5bb1c.tar.gz
vyos-cloud-init-f6c71fd758a3589ac5f62fd251d60b00edf5bb1c.zip
Add CloudLinux OS support (#1003)
https://www.cloudlinux.com/
Diffstat (limited to 'cloudinit/tests')
-rw-r--r--cloudinit/tests/test_util.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/cloudinit/tests/test_util.py b/cloudinit/tests/test_util.py
index 9dd01158..f11cfb27 100644
--- a/cloudinit/tests/test_util.py
+++ b/cloudinit/tests/test_util.py
@@ -186,6 +186,20 @@ OS_RELEASE_VIRTUOZZO_8 = dedent("""\
BUG_REPORT_URL="https://bugs.openvz.org"
""")
+OS_RELEASE_CLOUDLINUX_8 = dedent("""\
+ NAME="CloudLinux"
+ VERSION="8.4 (Valery Rozhdestvensky)"
+ ID="cloudlinux"
+ ID_LIKE="rhel fedora centos"
+ VERSION_ID="8.4"
+ PLATFORM_ID="platform:el8"
+ PRETTY_NAME="CloudLinux 8.4 (Valery Rozhdestvensky)"
+ ANSI_COLOR="0;31"
+ CPE_NAME="cpe:/o:cloudlinux:cloudlinux:8.4:GA:server"
+ HOME_URL="https://www.cloudlinux.com/"
+ BUG_REPORT_URL="https://www.cloudlinux.com/support"
+""")
+
REDHAT_RELEASE_CENTOS_6 = "CentOS release 6.10 (Final)"
REDHAT_RELEASE_CENTOS_7 = "CentOS Linux release 7.5.1804 (Core)"
REDHAT_RELEASE_REDHAT_6 = (
@@ -200,7 +214,8 @@ REDHAT_RELEASE_ROCKY_8 = (
"Rocky Linux release 8.3 (Green Obsidian)")
REDHAT_RELEASE_VIRTUOZZO_8 = (
"Virtuozzo Linux release 8")
-
+REDHAT_RELEASE_CLOUDLINUX_8 = (
+ "CloudLinux release 8.4 (Valery Rozhdestvensky)")
OS_RELEASE_DEBIAN = dedent("""\
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
@@ -680,6 +695,22 @@ class TestGetLinuxDistro(CiTestCase):
self.assertEqual(('virtuozzo', '8', 'Virtuozzo Linux'), dist)
@mock.patch('cloudinit.util.load_file')
+ def test_get_linux_cloud8_rhrelease(self, m_os_release, m_path_exists):
+ """Verify cloudlinux 8 read from redhat-release."""
+ m_os_release.return_value = REDHAT_RELEASE_CLOUDLINUX_8
+ m_path_exists.side_effect = TestGetLinuxDistro.redhat_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('cloudlinux', '8.4', 'Valery Rozhdestvensky'), dist)
+
+ @mock.patch('cloudinit.util.load_file')
+ def test_get_linux_cloud8_osrelease(self, m_os_release, m_path_exists):
+ """Verify cloudlinux 8 read from os-release."""
+ m_os_release.return_value = OS_RELEASE_CLOUDLINUX_8
+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('cloudlinux', '8.4', 'Valery Rozhdestvensky'), 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