summaryrefslogtreecommitdiff
path: root/cloudinit/tests
diff options
context:
space:
mode:
authoreb3095 <45504889+eb3095@users.noreply.github.com>2021-07-21 16:48:05 -0400
committerGitHub <noreply@github.com>2021-07-21 15:48:05 -0500
commit4257e30ac4b8730af35c078f2df0a2234dd19ffa (patch)
tree83920051229a287f584a48cc16ac349dc4538d33 /cloudinit/tests
parentf0ab1e64852d50f4fe0de84e0bca0ee8bb516a9f (diff)
downloadvyos-cloud-init-4257e30ac4b8730af35c078f2df0a2234dd19ffa.tar.gz
vyos-cloud-init-4257e30ac4b8730af35c078f2df0a2234dd19ffa.zip
Add VZLinux support (#951)
Virtuozzo Linux is a distro based off of CentOS 8, similar to Alma Linux and Rocky Linux.
Diffstat (limited to 'cloudinit/tests')
-rw-r--r--cloudinit/tests/test_util.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/cloudinit/tests/test_util.py b/cloudinit/tests/test_util.py
index a1ccb1dc..bd7720d1 100644
--- a/cloudinit/tests/test_util.py
+++ b/cloudinit/tests/test_util.py
@@ -140,6 +140,20 @@ OS_RELEASE_ROCKY_8 = dedent("""\
ROCKY_SUPPORT_PRODUCT_VERSION="8"
""")
+OS_RELEASE_VIRTUOZZO_8 = dedent("""\
+ NAME="Virtuozzo Linux"
+ VERSION="8"
+ ID="virtuozzo"
+ ID_LIKE="rhel fedora"
+ VERSION_ID="8"
+ PLATFORM_ID="platform:el8"
+ PRETTY_NAME="Virtuozzo Linux"
+ ANSI_COLOR="0;31"
+ CPE_NAME="cpe:/o:virtuozzoproject:vzlinux:8"
+ HOME_URL="https://www.vzlinux.org"
+ BUG_REPORT_URL="https://bugs.openvz.org"
+""")
+
REDHAT_RELEASE_CENTOS_6 = "CentOS release 6.10 (Final)"
REDHAT_RELEASE_CENTOS_7 = "CentOS Linux release 7.5.1804 (Core)"
REDHAT_RELEASE_REDHAT_6 = (
@@ -150,6 +164,8 @@ REDHAT_RELEASE_ALMALINUX_8 = (
"AlmaLinux release 8.3 (Purple Manul)")
REDHAT_RELEASE_ROCKY_8 = (
"Rocky Linux release 8.3 (Green Obsidian)")
+REDHAT_RELEASE_VIRTUOZZO_8 = (
+ "Virtuozzo Linux release 8")
OS_RELEASE_DEBIAN = dedent("""\
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
@@ -582,6 +598,22 @@ class TestGetLinuxDistro(CiTestCase):
self.assertEqual(('rocky', '8.3', 'Green Obsidian'), dist)
@mock.patch('cloudinit.util.load_file')
+ def test_get_linux_virtuozzo8_rhrelease(self, m_os_release, m_path_exists):
+ """Verify virtuozzo linux 8 read from redhat-release."""
+ m_os_release.return_value = REDHAT_RELEASE_VIRTUOZZO_8
+ m_path_exists.side_effect = TestGetLinuxDistro.redhat_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('virtuozzo', '8', 'Virtuozzo Linux'), dist)
+
+ @mock.patch('cloudinit.util.load_file')
+ def test_get_linux_virtuozzo8_osrelease(self, m_os_release, m_path_exists):
+ """Verify virtuozzo linux 8 read from os-release."""
+ m_os_release.return_value = OS_RELEASE_VIRTUOZZO_8
+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('virtuozzo', '8', 'Virtuozzo Linux'), 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