summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--cloudinit/config/cc_ntp.py2
-rw-r--r--cloudinit/config/cc_yum_add_repo.py6
-rwxr-xr-xcloudinit/distros/__init__.py2
-rw-r--r--cloudinit/distros/virtuozzo.py9
-rw-r--r--cloudinit/net/sysconfig.py3
-rw-r--r--cloudinit/tests/test_util.py32
-rw-r--r--cloudinit/util.py17
-rw-r--r--config/cloud.cfg.tmpl6
-rw-r--r--systemd/cloud-init-generator.tmpl2
-rw-r--r--systemd/cloud-init.service.tmpl2
-rw-r--r--tests/unittests/test_cli.py2
-rwxr-xr-xtools/render-cloudcfg2
13 files changed, 73 insertions, 14 deletions
diff --git a/README.md b/README.md
index 462e3204..832d8b43 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ get in contact with that distribution and send them our way!
| Supported OSes | Supported Public Clouds | Supported Private Clouds |
| --- | --- | --- |
-| Alpine Linux<br />ArchLinux<br />Debian<br />DragonFlyBSD<br />Fedora<br />FreeBSD<br />Gentoo Linux<br />NetBSD<br />OpenBSD<br />RHEL/CentOS/AlmaLinux/Rocky/PhotonOS<br />SLES/openSUSE<br />Ubuntu<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> | Amazon Web Services<br />Microsoft Azure<br />Google Cloud Platform<br />Oracle Cloud Infrastructure<br />Softlayer<br />Rackspace Public Cloud<br />IBM Cloud<br />DigitalOcean<br />Bigstep<br />Hetzner<br />Joyent<br />CloudSigma<br />Alibaba Cloud<br />OVH<br />OpenNebula<br />Exoscale<br />Scaleway<br />CloudStack<br />AltCloud<br />SmartOS<br />HyperOne<br />Vultr<br />Rootbox<br /> | Bare metal installs<br />OpenStack<br />LXD<br />KVM<br />Metal-as-a-Service (MAAS)<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />|
+| Alpine Linux<br />ArchLinux<br />Debian<br />DragonFlyBSD<br />Fedora<br />FreeBSD<br />Gentoo Linux<br />NetBSD<br />OpenBSD<br />RHEL/CentOS/AlmaLinux/Rocky/PhotonOS/Virtuozzo<br />SLES/openSUSE<br />Ubuntu<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> | Amazon Web Services<br />Microsoft Azure<br />Google Cloud Platform<br />Oracle Cloud Infrastructure<br />Softlayer<br />Rackspace Public Cloud<br />IBM Cloud<br />DigitalOcean<br />Bigstep<br />Hetzner<br />Joyent<br />CloudSigma<br />Alibaba Cloud<br />OVH<br />OpenNebula<br />Exoscale<br />Scaleway<br />CloudStack<br />AltCloud<br />SmartOS<br />HyperOne<br />Vultr<br />Rootbox<br /> | Bare metal installs<br />OpenStack<br />LXD<br />KVM<br />Metal-as-a-Service (MAAS)<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />|
## To start developing cloud-init
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index acf3251d..d227efb9 100644
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
@@ -25,7 +25,7 @@ frequency = PER_INSTANCE
NTP_CONF = '/etc/ntp.conf'
NR_POOL_SERVERS = 4
distros = ['almalinux', 'alpine', 'centos', 'debian', 'fedora', 'opensuse',
- 'photon', 'rhel', 'rocky', 'sles', 'ubuntu']
+ 'photon', 'rhel', 'rocky', 'sles', 'ubuntu', 'virtuozzo']
NTP_CLIENT_CONFIG = {
'chrony': {
diff --git a/cloudinit/config/cc_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py
index 67f09686..6e6133d1 100644
--- a/cloudinit/config/cc_yum_add_repo.py
+++ b/cloudinit/config/cc_yum_add_repo.py
@@ -18,7 +18,8 @@ entry, the config entry will be skipped.
**Module frequency:** per always
-**Supported distros:** almalinux, centos, fedora, photon, rhel, rocky
+**Supported distros:** almalinux, centos, fedora, photon, rhel, rocky,
+ virtuozzo
**Config keys**::
@@ -36,7 +37,8 @@ from configparser import ConfigParser
from cloudinit import util
-distros = ['almalinux', 'centos', 'fedora', 'photon', 'rhel', 'rocky']
+distros = ['almalinux', 'centos', 'fedora', 'photon', 'rhel', 'rocky',
+ 'virtuozzo']
def _canonicalize_id(repo_id):
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 40c4f2ac..7b813167 100755
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -50,7 +50,7 @@ OSFAMILIES = {
'freebsd': ['freebsd'],
'gentoo': ['gentoo'],
'redhat': ['almalinux', 'amazon', 'centos', 'fedora', 'photon', 'rhel',
- 'rocky'],
+ 'rocky', 'virtuozzo'],
'suse': ['opensuse', 'sles'],
}
diff --git a/cloudinit/distros/virtuozzo.py b/cloudinit/distros/virtuozzo.py
new file mode 100644
index 00000000..edb3165d
--- /dev/null
+++ b/cloudinit/distros/virtuozzo.py
@@ -0,0 +1,9 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
+from cloudinit.distros import rhel
+
+
+class Distro(rhel.Distro):
+ pass
+
+# vi: ts=4 expandtab
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index 8031cd3a..49f52e9d 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -18,7 +18,8 @@ from .network_state import (
is_ipv6_addr, net_prefix_to_ipv4_mask, subnet_is_ipv6, IPV6_DYNAMIC_TYPES)
LOG = logging.getLogger(__name__)
-KNOWN_DISTROS = ['almalinux', 'centos', 'fedora', 'rhel', 'rocky', 'suse']
+KNOWN_DISTROS = ['almalinux', 'centos', 'fedora', 'rhel', 'rocky', 'suse',
+ 'virtuozzo']
NM_CFG_FILE = "/etc/NetworkManager/NetworkManager.conf"
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
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 7995c6c8..3bed1aed 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -453,9 +453,19 @@ def _parse_redhat_release(release_file=None):
redhat_regex = (
r'(?P<name>.+) release (?P<version>[\d\.]+) '
r'\((?P<codename>[^)]+)\)')
+
+ # Virtuozzo deviates here
+ if "Virtuozzo" in redhat_release:
+ redhat_regex = r'(?P<name>.+) release (?P<version>[\d\.]+)'
+
match = re.match(redhat_regex, redhat_release)
if match:
group = match.groupdict()
+
+ # Virtuozzo has no codename in this file
+ if "Virtuozzo" in group['name']:
+ group['codename'] = group['name']
+
group['name'] = group['name'].lower().partition(' linux')[0]
if group['name'] == 'red hat enterprise':
group['name'] = 'redhat'
@@ -470,9 +480,11 @@ def get_linux_distro():
distro_version = ''
flavor = ''
os_release = {}
+ os_release_rhel = False
if os.path.exists('/etc/os-release'):
os_release = load_shell_content(load_file('/etc/os-release'))
if not os_release:
+ os_release_rhel = True
os_release = _parse_redhat_release()
if os_release:
distro_name = os_release.get('ID', '')
@@ -485,6 +497,9 @@ def get_linux_distro():
flavor = platform.machine()
elif distro_name == 'photon':
flavor = os_release.get('PRETTY_NAME', '')
+ elif distro_name == 'virtuozzo' and not os_release_rhel:
+ # Only use this if the redhat file is not parsed
+ flavor = os_release.get('PRETTY_NAME', '')
else:
flavor = os_release.get('VERSION_CODENAME', '')
if not flavor:
@@ -533,7 +548,7 @@ def system_info():
linux_dist = info['dist'][0].lower()
if linux_dist in (
'almalinux', 'alpine', 'arch', 'centos', 'debian', 'fedora',
- 'photon', 'rhel', 'rocky', 'suse'):
+ 'photon', 'rhel', 'rocky', 'suse', 'virtuozzo'):
var = linux_dist
elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
var = 'ubuntu'
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
index cb2a625b..f918d919 100644
--- a/config/cloud.cfg.tmpl
+++ b/config/cloud.cfg.tmpl
@@ -32,7 +32,7 @@ disable_root: true
{% endif %}
{% if variant in ["almalinux", "alpine", "amazon", "centos", "fedora",
- "rhel", "rocky"] %}
+ "rhel", "rocky", "virtuozzo"] %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
{% if variant == "amazon" %}
resize_rootfs: noblock
@@ -174,7 +174,7 @@ system_info:
# This will affect which distro class gets used
{% if variant in ["almalinux", "alpine", "amazon", "arch", "centos", "debian",
"fedora", "freebsd", "netbsd", "openbsd", "photon", "rhel",
- "rocky", "suse", "ubuntu"] %}
+ "rocky", "suse", "ubuntu", "virtuozzo"] %}
distro: {{ variant }}
{% elif variant in ["dragonfly"] %}
distro: dragonflybsd
@@ -228,7 +228,7 @@ system_info:
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
{% elif variant in ["almalinux", "alpine", "amazon", "arch", "centos", "fedora",
- "rhel", "rocky", "suse"] %}
+ "rhel", "rocky", "suse", "virtuozzo"] %}
# Default user name + that default users groups (if added/used)
default_user:
{% if variant == "amazon" %}
diff --git a/systemd/cloud-init-generator.tmpl b/systemd/cloud-init-generator.tmpl
index 0713db16..1d6af5ae 100644
--- a/systemd/cloud-init-generator.tmpl
+++ b/systemd/cloud-init-generator.tmpl
@@ -83,7 +83,7 @@ default() {
check_for_datasource() {
local ds_rc=""
-{% if variant in ["almalinux", "rhel", "fedora", "centos", "rocky"] %}
+{% if variant in ["almalinux", "rhel", "fedora", "centos", "rocky", "virtuozzo"] %}
local dsidentify="/usr/libexec/cloud-init/ds-identify"
{% else %}
local dsidentify="/usr/lib/cloud-init/ds-identify"
diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
index c773e411..cab3ec51 100644
--- a/systemd/cloud-init.service.tmpl
+++ b/systemd/cloud-init.service.tmpl
@@ -12,7 +12,7 @@ After=systemd-networkd-wait-online.service
{% if variant in ["ubuntu", "unknown", "debian"] %}
After=networking.service
{% endif %}
-{% if variant in ["almalinux", "centos", "fedora", "rhel", "rocky"] %}
+{% if variant in ["almalinux", "centos", "fedora", "rhel", "rocky", "virtuozzo"] %}
After=network.service
After=NetworkManager.service
{% endif %}
diff --git a/tests/unittests/test_cli.py b/tests/unittests/test_cli.py
index fdb4026c..90d8f7b9 100644
--- a/tests/unittests/test_cli.py
+++ b/tests/unittests/test_cli.py
@@ -225,7 +225,7 @@ class TestCLI(test_helpers.FilesystemMockingTestCase):
expected_doc_sections = [
'**Supported distros:** all',
('**Supported distros:** almalinux, alpine, centos, debian, '
- 'fedora, opensuse, photon, rhel, rocky, sles, ubuntu'),
+ 'fedora, opensuse, photon, rhel, rocky, sles, ubuntu, virtuozzo'),
'**Config schema**:\n **resize_rootfs:** (true/false/noblock)',
'**Examples**::\n\n runcmd:\n - [ ls, -l, / ]\n'
]
diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
index 7e667de4..227bd8ab 100755
--- a/tools/render-cloudcfg
+++ b/tools/render-cloudcfg
@@ -6,7 +6,7 @@ import sys
VARIANTS = ["almalinux", "alpine", "amazon", "arch", "centos", "debian",
"fedora", "freebsd", "netbsd", "openbsd", "photon", "rhel",
- "suse","rocky", "ubuntu", "unknown"]
+ "suse","rocky", "ubuntu", "unknown", "virtuozzo"]
if "avoid-pep8-E402-import-not-top-of-file":