Skip to content
Snippets Groups Projects
Verified Commit a4cda0be authored by Louis Abel's avatar Louis Abel :tv:
Browse files

backport cloud-init patch

parent 9a02af7c
No related branches found
No related tags found
No related merge requests found
diff --git a/SOURCES/ci-network-Fix-type-and-respect-name-when-rendering-vla.patch b/SOURCES/ci-network-Fix-type-and-respect-name-when-rendering-vla.patch
index a2ef2dc..b991a50 100644
--- a/SOURCES/ci-network-Fix-type-and-respect-name-when-rendering-vla.patch
+++ b/SOURCES/ci-network-Fix-type-and-respect-name-when-rendering-vla.patch
@@ -92,7 +92,7 @@ index c078898..078636a 100644
+ if iface_name not in supported:
+ LOG.info(
+ "Name '%s' for vlan '%s' is not officially supported"
-+ "by RHEL. Supported: %s",
++ "by Rocky. Supported: %s",
+ iface_name, rdev, ' '.join(supported))
+ iface_cfg['PHYSDEV'] = rdev
@@ -103,7 +103,7 @@ index c078898..078636a 100644
+def _supported_vlan_names(rdev, vid):
-+ """Return list of supported names for vlan devices per RHEL doc
++ """Return list of supported names for vlan devices per Rocky doc
+ 11.5. Naming Scheme for VLAN Interfaces."""
+ return [
+ v.format(rdev=rdev, vid=int(vid))
diff -Naupr cloud-init-21.1/cloudinit/config/cc_ntp.py cloud-init-21.1-patch/cloudinit/config/cc_ntp.py
--- cloud-init-21.1/cloudinit/config/cc_ntp.py 2021-02-23 14:41:41.000000000 +0000
+++ cloud-init-21.1-patch/cloudinit/config/cc_ntp.py 2021-10-08 23:48:07.181164138 +0000
@@ -25,7 +25,7 @@ frequency = PER_INSTANCE
NTP_CONF = '/etc/ntp.conf'
NR_POOL_SERVERS = 4
distros = ['alpine', 'centos', 'debian', 'fedora', 'opensuse', 'rhel',
- 'sles', 'ubuntu']
+ 'sles', 'ubuntu', 'rocky']
NTP_CLIENT_CONFIG = {
'chrony': {
diff -Naupr cloud-init-21.1/cloudinit/config/cc_yum_add_repo.py cloud-init-21.1-patch/cloudinit/config/cc_yum_add_repo.py
--- cloud-init-21.1/cloudinit/config/cc_yum_add_repo.py 2021-02-23 14:41:41.000000000 +0000
+++ cloud-init-21.1-patch/cloudinit/config/cc_yum_add_repo.py 2021-10-08 23:48:19.656244504 +0000
@@ -36,7 +36,7 @@ from configparser import ConfigParser
from cloudinit import util
-distros = ['centos', 'fedora', 'rhel']
+distros = ['centos', 'fedora', 'rhel', 'rocky']
def _canonicalize_id(repo_id):
diff -Naupr cloud-init-21.1/cloudinit/distros/__init__.py cloud-init-21.1-patch/cloudinit/distros/__init__.py
--- cloud-init-21.1/cloudinit/distros/__init__.py 2021-02-23 14:41:41.000000000 +0000
+++ cloud-init-21.1-patch/cloudinit/distros/__init__.py 2021-10-08 23:48:36.975356075 +0000
@@ -46,7 +46,7 @@ OSFAMILIES = {
'debian': ['debian', 'ubuntu'],
'freebsd': ['freebsd'],
'gentoo': ['gentoo'],
- 'redhat': ['amazon', 'centos', 'fedora', 'rhel'],
+ 'redhat': ['amazon', 'centos', 'fedora', 'rhel', 'rocky'],
'suse': ['opensuse', 'sles'],
}
diff -Naupr cloud-init-21.1/cloudinit/distros/rocky.py cloud-init-21.1-patch/cloudinit/distros/rocky.py
--- cloud-init-21.1/cloudinit/distros/rocky.py 1970-01-01 00:00:00.000000000 +0000
+++ cloud-init-21.1-patch/cloudinit/distros/rocky.py 2021-10-08 23:49:05.858542121 +0000
@@ -0,0 +1,8 @@
+# file part of cloud-init
+
+from cloudinit.distros import rhel
+
+class Distro(rhel.Distro):
+ pass
+
+# vi: ts=4 expandtab
diff -Naupr cloud-init-21.1/cloudinit/net/sysconfig.py cloud-init-21.1-patch/cloudinit/net/sysconfig.py
--- cloud-init-21.1/cloudinit/net/sysconfig.py 2021-02-23 14:41:41.000000000 +0000
+++ cloud-init-21.1-patch/cloudinit/net/sysconfig.py 2021-10-08 23:49:35.701734331 +0000
@@ -19,7 +19,7 @@ from .network_state import (
LOG = logging.getLogger(__name__)
NM_CFG_FILE = "/etc/NetworkManager/NetworkManager.conf"
-KNOWN_DISTROS = ['centos', 'fedora', 'rhel', 'suse']
+KNOWN_DISTROS = ['centos', 'fedora', 'rhel', 'suse', 'rocky']
def _make_header(sep='#'):
diff -Naupr cloud-init-21.1/cloudinit/util.py cloud-init-21.1-patch/cloudinit/util.py
--- cloud-init-21.1/cloudinit/util.py 2021-02-23 14:41:41.000000000 +0000
+++ cloud-init-21.1-patch/cloudinit/util.py 2021-10-08 23:50:19.793018351 +0000
@@ -522,7 +522,7 @@ def system_info():
linux_dist = info['dist'][0].lower()
if linux_dist in (
'alpine', 'arch', 'centos', 'debian', 'fedora', 'rhel',
- 'suse'):
+ 'suse', 'rocky'):
var = linux_dist
elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
var = 'ubuntu'
diff -Naupr cloud-init-21.1/config/cloud.cfg.tmpl cloud-init-21.1-patch/config/cloud.cfg.tmpl
--- cloud-init-21.1/config/cloud.cfg.tmpl 2021-02-23 14:41:41.000000000 +0000
+++ cloud-init-21.1-patch/config/cloud.cfg.tmpl 2021-10-08 23:52:07.479712040 +0000
@@ -21,7 +21,8 @@ disable_root: false
disable_root: true
{% endif %}
-{% if variant in ["alpine", "amazon", "centos", "fedora", "rhel"] %}
+{% if variant in ["alpine", "amazon", "centos", "fedora",
+ "rhel", "rocky"] %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
{% if variant == "amazon" %}
resize_rootfs: noblock
@@ -155,7 +156,7 @@ system_info:
# This will affect which distro class gets used
{% if variant in ["alpine", "amazon", "arch", "centos", "debian",
"fedora", "freebsd", "netbsd", "openbsd", "rhel",
- "suse", "ubuntu"] %}
+ "suse", "ubuntu", "rocky"] %}
distro: {{ variant }}
{% else %}
# Unknown/fallback distro.
@@ -207,7 +208,7 @@ system_info:
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
{% elif variant in ["alpine", "amazon", "arch", "centos", "fedora",
- "rhel", "suse"] %}
+ "rhel", "suse", "rocky"] %}
# Default user name + that default users groups (if added/used)
default_user:
{% if variant == "amazon" %}
diff -Naupr cloud-init-21.1/Makefile cloud-init-21.1-patch/Makefile
--- cloud-init-21.1/Makefile 2021-02-23 14:41:41.000000000 +0000
+++ cloud-init-21.1-patch/Makefile 2021-10-08 23:52:38.729913327 +0000
@@ -35,6 +35,9 @@ ci-deps-ubuntu:
ci-deps-centos:
@$(PYTHON) $(CWD)/tools/read-dependencies --distro centos --test-distro
+ci-deps-rocky:
+ @$(PYTHON) $(CWD)/tools/read-dependencies --distro rocky --test-distro
+
pip-requirements:
@echo "Installing cloud-init dependencies..."
$(PIP_INSTALL) -r "$@.txt" -q
diff -Naupr cloud-init-21.1/systemd/cloud-init-generator.tmpl cloud-init-21.1-patch/systemd/cloud-init-generator.tmpl
--- cloud-init-21.1/systemd/cloud-init-generator.tmpl 2021-02-23 14:41:41.000000000 +0000
+++ cloud-init-21.1-patch/systemd/cloud-init-generator.tmpl 2021-10-08 23:53:06.322091066 +0000
@@ -83,7 +83,7 @@ default() {
check_for_datasource() {
local ds_rc=""
-{% if variant in ["rhel", "fedora", "centos"] %}
+{% if variant in ["rhel", "fedora", "centos", "rocky"] %}
local dsidentify="/usr/libexec/cloud-init/ds-identify"
{% else %}
local dsidentify="/usr/lib/cloud-init/ds-identify"
diff -Naupr cloud-init-21.1/systemd/cloud-init.service.tmpl cloud-init-21.1-patch/systemd/cloud-init.service.tmpl
--- cloud-init-21.1/systemd/cloud-init.service.tmpl 2021-02-23 14:41:41.000000000 +0000
+++ cloud-init-21.1-patch/systemd/cloud-init.service.tmpl 2021-10-08 23:53:26.744222622 +0000
@@ -10,7 +10,7 @@ After=systemd-networkd-wait-online.servi
{% if variant in ["ubuntu", "unknown", "debian"] %}
After=networking.service
{% endif %}
-{% if variant in ["centos", "fedora", "rhel"] %}
+{% if variant in ["centos", "fedora", "rhel", "rocky"] %}
After=network.service
After=NetworkManager.service
{% endif %}
diff -Naupr cloud-init-21.1/tools/read-dependencies cloud-init-21.1-patch/tools/read-dependencies
--- cloud-init-21.1/tools/read-dependencies 2021-02-23 14:41:41.000000000 +0000
+++ cloud-init-21.1-patch/tools/read-dependencies 2021-10-08 23:56:02.246225387 +0000
@@ -25,6 +25,7 @@ DISTRO_PKG_TYPE_MAP = {
'centos': 'redhat',
'redhat': 'redhat',
'debian': 'debian',
+ 'rocky': 'redhat',
'ubuntu': 'debian',
'opensuse': 'suse',
'suse': 'suse'
@@ -66,11 +67,13 @@ ZYPPER_INSTALL = [
DRY_DISTRO_INSTALL_PKG_CMD = {
'centos': ['yum', 'install', '--assumeyes'],
'redhat': ['yum', 'install', '--assumeyes'],
+ 'rocky': ['yum', 'install', '--assumeyes'],
}
DISTRO_INSTALL_PKG_CMD = {
'centos': MAYBE_RELIABLE_YUM_INSTALL,
'redhat': MAYBE_RELIABLE_YUM_INSTALL,
+ 'rocky': MAYBE_RELIABLE_YUM_INSTALL,
'debian': ['apt', 'install', '-y'],
'ubuntu': ['apt', 'install', '-y'],
'opensuse': ZYPPER_INSTALL,
@@ -276,7 +279,7 @@ def pkg_install(pkg_list, distro, test_d
if distro in ['centos', 'redhat']:
# CentOS and Redhat need epel-release to access oauthlib and jsonschema
subprocess.check_call(install_cmd + ['epel-release'])
- if distro in ['suse', 'opensuse', 'redhat', 'centos']:
+ if distro in ['suse', 'opensuse', 'redhat', 'centos', 'rocky']:
pkg_list.append('rpm-build')
subprocess.check_call(install_cmd + pkg_list)
diff -Naupr cloud-init-21.1/tools/render-cloudcfg cloud-init-21.1-patch/tools/render-cloudcfg
--- cloud-init-21.1/tools/render-cloudcfg 2021-02-23 14:41:41.000000000 +0000
+++ cloud-init-21.1-patch/tools/render-cloudcfg 2021-10-08 23:56:20.840345321 +0000
@@ -6,7 +6,7 @@ import sys
VARIANTS = ["alpine", "amazon", "arch", "centos", "debian", "fedora",
"freebsd", "netbsd", "openbsd", "rhel", "suse", "ubuntu",
- "unknown"]
+ "rocky", "unknown"]
if "avoid-pep8-E402-import-not-top-of-file":
add {
file: "ROCKY/_supporting/cloud-init-rocky-support.patch"
file: "ROCKY/_supporting/backports.patch"
}
spec_change {
......@@ -8,7 +8,10 @@ spec_change {
type: Patch
add: true
}
append {
field: "Release"
value: ".0.1"
}
changelog {
author_name: "Release Engineering"
author_email: "releng@rockylinux.org"
......
From cd54584819d62a0c6ee1c7085c425fd930604f9a Mon Sep 17 00:00:00 2001
From: Louis Abel <label@firemonitor.angelsofclockwork.net>
Date: Tue, 29 Nov 2022 11:25:06 -0700
Subject: [PATCH] fix is_rhel temporarily
---
config/cloud.cfg.tmpl | 27 +++++++++++++------------
tests/unittests/test_render_cloudcfg.py | 1 +
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
index 80ab4f9..08b6efb 100644
--- a/config/cloud.cfg.tmpl
+++ b/config/cloud.cfg.tmpl
@@ -2,6 +2,7 @@
# The top level settings are used as module
# and system configuration.
{% set is_bsd = variant in ["dragonfly", "freebsd", "netbsd", "openbsd"] %}
+{% set is_rhel = variant in ["rhel", "centos", "rocky"] %}
{% if is_bsd %}
syslog_fix_perms: root:wheel
{% elif variant in ["suse"] %}
@@ -32,9 +33,9 @@ disable_root: false
disable_root: true
{% endif %}
-{% if variant in ["almalinux", "alpine", "amazon", "centos", "cloudlinux", "eurolinux",
- "fedora", "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %}
-{% if variant == "rhel" %}
+{% if variant in ["almalinux", "alpine", "amazon", "cloudlinux", "eurolinux",
+ "fedora", "miraclelinux", "openEuler", "openmandriva", "rocky", "virtuozzo"] or is_rhel %}
+{% if is_rhel %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service,_netdev', '0', '2']
{% else %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
@@ -70,7 +71,7 @@ network:
config: disabled
{% endif %}
-{% if variant == "rhel" %}
+{% if is_rhel %}
# Default redhat settings:
ssh_deletekeys: true
ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519']
@@ -119,16 +120,16 @@ cloud_config_modules:
{% endif %}
{% if variant not in ["photon"] %}
- ssh-import-id
-{% if variant not in ["rhel"] %}
+{% if not is_rhel %}
- keyboard
{% endif %}
- locale
{% endif %}
- set-passwords
-{% if variant in ["rhel"] %}
+{% if is_rhel %}
- rh_subscription
{% endif %}
-{% if variant in ["rhel", "fedora", "photon"] %}
+{% if variant in ["fedora", "openmandriva", "photon"] or is_rhel %}
{% if variant not in ["photon"] %}
- spacewalk
{% endif %}
@@ -193,9 +194,9 @@ cloud_final_modules:
# (not accessible to handlers/transforms)
system_info:
# This will affect which distro class gets used
-{% if variant in ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "debian",
+{% if variant in ["almalinux", "alpine", "amazon", "arch", "cloudlinux", "debian",
"eurolinux", "fedora", "freebsd", "gentoo", "netbsd", "miraclelinux", "openbsd", "openEuler",
- "photon", "rhel", "rocky", "suse", "ubuntu", "virtuozzo"] %}
+ "openmandriva", "photon", "rocky", "suse", "ubuntu", "virtuozzo"] or is_rhel %}
distro: {{ variant }}
{% elif variant in ["dragonfly"] %}
distro: dragonflybsd
@@ -248,15 +249,15 @@ system_info:
primary: http://ports.ubuntu.com/ubuntu-ports
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
-{% elif variant in ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "eurolinux",
- "fedora", "gentoo", "miraclelinux", "openEuler", "rhel", "rocky", "suse", "virtuozzo"] %}
+{% elif variant in ["almalinux", "alpine", "amazon", "arch", "cloudlinux", "eurolinux",
+ "fedora", "gentoo", "miraclelinux", "openEuler", "openmandriva", "rocky", "suse", "virtuozzo"] or is_rhel %}
# Default user name + that default users groups (if added/used)
default_user:
{% if variant == "amazon" %}
name: ec2-user
lock_passwd: True
gecos: EC2 Default User
-{% elif variant == "rhel" %}
+{% elif is_rhel %}
name: cloud-user
lock_passwd: true
gecos: Cloud User
@@ -275,7 +276,7 @@ system_info:
groups: [adm, sudo]
{% elif variant == "arch" %}
groups: [wheel, users]
-{% elif variant == "rhel" %}
+{% elif is_rhel %}
groups: [adm, systemd-journal]
{% else %}
groups: [wheel, adm, systemd-journal]
diff --git a/tests/unittests/test_render_cloudcfg.py b/tests/unittests/test_render_cloudcfg.py
index 9f95d44..1a6e271 100644
--- a/tests/unittests/test_render_cloudcfg.py
+++ b/tests/unittests/test_render_cloudcfg.py
@@ -69,6 +69,7 @@ class TestRenderCloudCfg:
"amazon": "ec2-user",
"debian": "ubuntu",
"rhel": "cloud-user",
+ "centos": "cloud-user",
"unknown": "ubuntu",
}
default_user = system_cfg["system_info"]["default_user"]["name"]
--
2.31.1
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
index 08b6efb..ed82d8d 100644
--- a/config/cloud.cfg.tmpl
+++ b/config/cloud.cfg.tmpl
@@ -2,7 +2,7 @@
# The top level settings are used as module
# and system configuration.
{% set is_bsd = variant in ["dragonfly", "freebsd", "netbsd", "openbsd"] %}
-{% set is_rhel = variant in ["rhel", "centos"] %}
+{% set is_rhel = variant in ["rhel", "centos", "rocky"] %}
{% if is_bsd %}
syslog_fix_perms: root:wheel
{% elif variant in ["suse"] %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment