summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Abel <nazunalika@users.noreply.github.com>2021-05-25 06:25:41 -0700
committerGitHub <noreply@github.com>2021-05-25 08:25:41 -0500
commit7c1d27b8836c266f6db1e179b98ef32effeb750e (patch)
tree0a7f4897b000ee0c1f7a1b16c5d2b06269fd25fd
parentc8db603218dd56123e43857d81f5eae5f66618f1 (diff)
downloadcloud-init-git-7c1d27b8836c266f6db1e179b98ef32effeb750e.tar.gz
Add Rocky Linux support to cloud-init (#906)
Rocky Linux is a RHEL-compatible distribution so all changes that have been made should be trivial.
-rw-r--r--README.md2
-rw-r--r--cloudinit/config/cc_ntp.py2
-rw-r--r--cloudinit/config/cc_yum_add_repo.py4
-rwxr-xr-xcloudinit/distros/__init__.py2
-rw-r--r--cloudinit/distros/rocky.py9
-rw-r--r--cloudinit/net/sysconfig.py2
-rw-r--r--cloudinit/tests/.test_util.py.swpbin0 -> 16384 bytes
-rw-r--r--cloudinit/tests/test_util.py35
-rw-r--r--cloudinit/util.py2
-rw-r--r--config/cloud.cfg.tmpl7
-rwxr-xr-xsystemd/cloud-init-generator.tmpl2
-rw-r--r--systemd/cloud-init.service.tmpl2
-rw-r--r--tests/unittests/test_cli.py3
-rw-r--r--tools/.github-cla-signers1
-rwxr-xr-xtools/render-cloudcfg4
15 files changed, 61 insertions, 16 deletions
diff --git a/README.md b/README.md
index 01fd3b07..bf232eba 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 />Fedora<br />FreeBSD<br />Gentoo Linux<br />NetBSD<br />OpenBSD<br />RHEL/CentOS/AlmaLinux<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 />Digital Ocean<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 />Fedora<br />FreeBSD<br />Gentoo Linux<br />NetBSD<br />OpenBSD<br />RHEL/CentOS/AlmaLinux/Rocky<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 />Digital Ocean<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 41c278ff..70c24610 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',
- 'rhel', 'sles', 'ubuntu']
+ 'rhel', 'rocky', 'sles', 'ubuntu']
NTP_CLIENT_CONFIG = {
'chrony': {
diff --git a/cloudinit/config/cc_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py
index db513ed7..7daa6bd9 100644
--- a/cloudinit/config/cc_yum_add_repo.py
+++ b/cloudinit/config/cc_yum_add_repo.py
@@ -18,7 +18,7 @@ entry, the config entry will be skipped.
**Module frequency:** per always
-**Supported distros:** almalinux, centos, fedora, rhel
+**Supported distros:** almalinux, centos, fedora, rhel, rocky
**Config keys**::
@@ -36,7 +36,7 @@ from configparser import ConfigParser
from cloudinit import util
-distros = ['almalinux', 'centos', 'fedora', 'rhel']
+distros = ['almalinux', 'centos', 'fedora', 'rhel', 'rocky']
def _canonicalize_id(repo_id):
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 107b928c..57e33621 100755
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -46,7 +46,7 @@ OSFAMILIES = {
'debian': ['debian', 'ubuntu'],
'freebsd': ['freebsd'],
'gentoo': ['gentoo'],
- 'redhat': ['almalinux', 'amazon', 'centos', 'fedora', 'rhel'],
+ 'redhat': ['almalinux', 'amazon', 'centos', 'fedora', 'rhel', 'rocky'],
'suse': ['opensuse', 'sles'],
}
diff --git a/cloudinit/distros/rocky.py b/cloudinit/distros/rocky.py
new file mode 100644
index 00000000..edb3165d
--- /dev/null
+++ b/cloudinit/distros/rocky.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 089b44b2..3a433c99 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -19,7 +19,7 @@ from .network_state import (
LOG = logging.getLogger(__name__)
NM_CFG_FILE = "/etc/NetworkManager/NetworkManager.conf"
-KNOWN_DISTROS = ['almalinux', 'centos', 'fedora', 'rhel', 'suse']
+KNOWN_DISTROS = ['almalinux', 'centos', 'fedora', 'rhel', 'rocky', 'suse']
def _make_header(sep='#'):
diff --git a/cloudinit/tests/.test_util.py.swp b/cloudinit/tests/.test_util.py.swp
new file mode 100644
index 00000000..78ef5865
--- /dev/null
+++ b/cloudinit/tests/.test_util.py.swp
Binary files differ
diff --git a/cloudinit/tests/test_util.py b/cloudinit/tests/test_util.py
index a4c02877..f9bc31be 100644
--- a/cloudinit/tests/test_util.py
+++ b/cloudinit/tests/test_util.py
@@ -124,6 +124,22 @@ OS_RELEASE_ALMALINUX_8 = dedent("""\
ALMALINUX_MANTISBT_PROJECT_VERSION="8.3"
""")
+OS_RELEASE_ROCKY_8 = dedent("""\
+ NAME="Rocky Linux"
+ VERSION="8.3 (Green Obsidian)"
+ ID="rocky"
+ ID_LIKE="rhel fedora"
+ VERSION_ID="8.3"
+ PLATFORM_ID="platform:el8"
+ PRETTY_NAME="Rocky Linux 8.3 (Green Obsidian)"
+ ANSI_COLOR="0;31"
+ CPE_NAME="cpe:/o:rocky:rocky:8"
+ HOME_URL="https://rockylinux.org/"
+ BUG_REPORT_URL="https://bugs.rockylinux.org/"
+ ROCKY_SUPPORT_PRODUCT="Rocky Linux"
+ ROCKY_SUPPORT_PRODUCT_VERSION="8"
+""")
+
REDHAT_RELEASE_CENTOS_6 = "CentOS release 6.10 (Final)"
REDHAT_RELEASE_CENTOS_7 = "CentOS Linux release 7.5.1804 (Core)"
REDHAT_RELEASE_REDHAT_6 = (
@@ -132,7 +148,8 @@ REDHAT_RELEASE_REDHAT_7 = (
"Red Hat Enterprise Linux Server release 7.5 (Maipo)")
REDHAT_RELEASE_ALMALINUX_8 = (
"AlmaLinux release 8.3 (Purple Manul)")
-
+REDHAT_RELEASE_ROCKY_8 = (
+ "Rocky Linux release 8.3 (Green Obsidian)")
OS_RELEASE_DEBIAN = dedent("""\
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
@@ -538,6 +555,22 @@ class TestGetLinuxDistro(CiTestCase):
self.assertEqual(('almalinux', '8.3', 'Purple Manul'), dist)
@mock.patch('cloudinit.util.load_file')
+ def test_get_linux_rocky8_rhrelease(self, m_os_release, m_path_exists):
+ """Verify rocky linux 8 read from redhat-release."""
+ m_os_release.return_value = REDHAT_RELEASE_ROCKY_8
+ m_path_exists.side_effect = TestGetLinuxDistro.redhat_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('rocky', '8.3', 'Green Obsidian'), dist)
+
+ @mock.patch('cloudinit.util.load_file')
+ def test_get_linux_rocky8_osrelease(self, m_os_release, m_path_exists):
+ """Verify rocky linux 8 read from os-release."""
+ m_os_release.return_value = OS_RELEASE_ROCKY_8
+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('rocky', '8.3', 'Green Obsidian'), 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 fdea1181..2de1123e 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -522,7 +522,7 @@ def system_info():
linux_dist = info['dist'][0].lower()
if linux_dist in (
'almalinux', 'alpine', 'arch', 'centos', 'debian', 'fedora',
- 'rhel', 'suse'):
+ 'rhel', 'rocky', 'suse'):
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 8656daa7..2f6c3a7d 100644
--- a/config/cloud.cfg.tmpl
+++ b/config/cloud.cfg.tmpl
@@ -21,7 +21,8 @@ disable_root: false
disable_root: true
{% endif %}
-{% if variant in ["almalinux", "alpine", "amazon", "centos", "fedora", "rhel"] %}
+{% if variant in ["almalinux", "alpine", "amazon", "centos", "fedora",
+ "rhel", "rocky"] %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
{% if variant == "amazon" %}
resize_rootfs: noblock
@@ -154,7 +155,7 @@ cloud_final_modules:
system_info:
# This will affect which distro class gets used
{% if variant in ["almalinux", "alpine", "amazon", "arch", "centos", "debian",
- "fedora", "freebsd", "netbsd", "openbsd", "rhel",
+ "fedora", "freebsd", "netbsd", "openbsd", "rhel", "rocky",
"suse", "ubuntu"] %}
distro: {{ variant }}
{% else %}
@@ -207,7 +208,7 @@ system_info:
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
{% elif variant in ["almalinux", "alpine", "amazon", "arch", "centos", "fedora",
- "rhel", "suse"] %}
+ "rhel", "rocky", "suse"] %}
# 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 9b103ef9..0713db16 100755
--- 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"] %}
+{% if variant in ["almalinux", "rhel", "fedora", "centos", "rocky"] %}
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 a5c51277..4da1a905 100644
--- a/systemd/cloud-init.service.tmpl
+++ b/systemd/cloud-init.service.tmpl
@@ -10,7 +10,7 @@ After=systemd-networkd-wait-online.service
{% if variant in ["ubuntu", "unknown", "debian"] %}
After=networking.service
{% endif %}
-{% if variant in ["almalinux", "centos", "fedora", "rhel"] %}
+{% if variant in ["almalinux", "centos", "fedora", "rhel", "rocky"] %}
After=network.service
After=NetworkManager.service
{% endif %}
diff --git a/tests/unittests/test_cli.py b/tests/unittests/test_cli.py
index f5cf514d..fbc6ec11 100644
--- a/tests/unittests/test_cli.py
+++ b/tests/unittests/test_cli.py
@@ -224,7 +224,8 @@ class TestCLI(test_helpers.FilesystemMockingTestCase):
self._call_main(['cloud-init', 'devel', 'schema', '--docs', 'all'])
expected_doc_sections = [
'**Supported distros:** all',
- '**Supported distros:** almalinux, alpine, centos, debian, fedora',
+ ('**Supported distros:** almalinux, alpine, centos, debian, '
+ 'fedora, opensuse, rhel, rocky, sles, ubuntu'),
'**Config schema**:\n **resize_rootfs:** (true/false/noblock)',
'**Examples**::\n\n runcmd:\n - [ ls, -l, / ]\n'
]
diff --git a/tools/.github-cla-signers b/tools/.github-cla-signers
index 6f626643..14916d31 100644
--- a/tools/.github-cla-signers
+++ b/tools/.github-cla-signers
@@ -35,6 +35,7 @@ manuelisimo
marlluslustosa
matthewruffell
mitechie
+nazunalika
nicolasbock
nishigori
olivierlemasle
diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
index f5990748..9ec554bd 100755
--- a/tools/render-cloudcfg
+++ b/tools/render-cloudcfg
@@ -5,8 +5,8 @@ import os
import sys
VARIANTS = ["almalinux", "alpine", "amazon", "arch", "centos", "debian",
- "fedora", "freebsd", "netbsd", "openbsd", "rhel", "suse", "ubuntu",
- "unknown"]
+ "fedora", "freebsd", "netbsd", "openbsd", "rhel", "suse", "rocky",
+ "ubuntu", "unknown"]
if "avoid-pep8-E402-import-not-top-of-file":