forked from rpms/cloud-init
Improve AlmaLinux OS support and compatibility
This commit is contained in:
parent
a73cc3e7d1
commit
6adb79da1b
@ -1,29 +0,0 @@
|
||||
From 7d91c98d0a06ea1e8bebf51cde13a6bbfd715b73 Mon Sep 17 00:00:00 2001
|
||||
From: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
|
||||
Date: Wed, 26 Oct 2022 19:48:04 +0400
|
||||
Subject: [PATCH 1/1] Fix the Yum Add Repo module for AlmaLinux OS
|
||||
|
||||
Include AlmaLinux OS in the list of distributions
|
||||
that supports cc_yum_add_repo
|
||||
|
||||
Signed-off-by: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
|
||||
---
|
||||
config/cloud.cfg.tmpl | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
|
||||
index 80ab4f9..2eff94e 100644
|
||||
--- a/config/cloud.cfg.tmpl
|
||||
+++ b/config/cloud.cfg.tmpl
|
||||
@@ -128,7 +128,7 @@ cloud_config_modules:
|
||||
{% if variant in ["rhel"] %}
|
||||
- rh_subscription
|
||||
{% endif %}
|
||||
-{% if variant in ["rhel", "fedora", "photon"] %}
|
||||
+{% if variant in ["almalinux", "rhel", "fedora", "photon"] %}
|
||||
{% if variant not in ["photon"] %}
|
||||
- spacewalk
|
||||
{% endif %}
|
||||
--
|
||||
2.37.3
|
||||
|
@ -0,0 +1,308 @@
|
||||
From 36abf30dbaf4f4ef03e6c56cb2557af95c709727 Mon Sep 17 00:00:00 2001
|
||||
From: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
|
||||
Date: Thu, 27 Oct 2022 19:22:03 +0400
|
||||
Subject: [PATCH 1/1] Improve AlmaLinux OS support and compatibility
|
||||
|
||||
Improve the compatibility with the upstream
|
||||
|
||||
Signed-off-by: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
|
||||
---
|
||||
cloudinit/settings.py | 2 +-
|
||||
cloudinit/sources/DataSourceRbxCloud.py | 2 +-
|
||||
config/cloud.cfg.tmpl | 10 +++++-----
|
||||
packages/pkg-deps.json | 14 ++++++++++++++
|
||||
systemd/cloud-config.service.tmpl | 2 +-
|
||||
systemd/cloud-final.service.tmpl | 4 ++--
|
||||
systemd/cloud-init-local.service.tmpl | 12 ++++++------
|
||||
systemd/cloud-init.service.tmpl | 4 ++--
|
||||
tests/unittests/test_net.py | 1 +
|
||||
tests/unittests/test_render_cloudcfg.py | 2 ++
|
||||
tools/read-dependencies | 6 +++++-
|
||||
11 files changed, 40 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/cloudinit/settings.py b/cloudinit/settings.py
|
||||
index 71672e1..e8224f8 100644
|
||||
--- a/cloudinit/settings.py
|
||||
+++ b/cloudinit/settings.py
|
||||
@@ -58,7 +58,7 @@ CFG_BUILTIN = {
|
||||
"cloud_dir": "/var/lib/cloud",
|
||||
"templates_dir": "/etc/cloud/templates/",
|
||||
},
|
||||
- "distro": "rhel",
|
||||
+ "distro": "almalinux",
|
||||
"network": {"renderers": None},
|
||||
},
|
||||
"vendor_data": {"enabled": True, "prefix": []},
|
||||
diff --git a/cloudinit/sources/DataSourceRbxCloud.py b/cloudinit/sources/DataSourceRbxCloud.py
|
||||
index 14ac77e..7cd14a1 100644
|
||||
--- a/cloudinit/sources/DataSourceRbxCloud.py
|
||||
+++ b/cloudinit/sources/DataSourceRbxCloud.py
|
||||
@@ -55,7 +55,7 @@ def _sub_arp(cmd):
|
||||
|
||||
def gratuitous_arp(items, distro):
|
||||
source_param = "-S"
|
||||
- if distro.name in ["fedora", "centos", "rhel"]:
|
||||
+ if distro.name in ["almalinux", "fedora", "centos", "rhel"]:
|
||||
source_param = "-s"
|
||||
for item in items:
|
||||
try:
|
||||
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
|
||||
index 80ab4f9..ce63c1b 100644
|
||||
--- a/config/cloud.cfg.tmpl
|
||||
+++ b/config/cloud.cfg.tmpl
|
||||
@@ -34,7 +34,7 @@ disable_root: true
|
||||
|
||||
{% if variant in ["almalinux", "alpine", "amazon", "centos", "cloudlinux", "eurolinux",
|
||||
"fedora", "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %}
|
||||
-{% if variant == "rhel" %}
|
||||
+{% if variant in ["almalinux", "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 +70,7 @@ network:
|
||||
config: disabled
|
||||
{% endif %}
|
||||
|
||||
-{% if variant == "rhel" %}
|
||||
+{% if variant in ["almalinux", "rhel"] %}
|
||||
# Default redhat settings:
|
||||
ssh_deletekeys: true
|
||||
ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519']
|
||||
@@ -119,7 +119,7 @@ cloud_config_modules:
|
||||
{% endif %}
|
||||
{% if variant not in ["photon"] %}
|
||||
- ssh-import-id
|
||||
-{% if variant not in ["rhel"] %}
|
||||
+{% if variant not in ["almalinux", "rhel"] %}
|
||||
- keyboard
|
||||
{% endif %}
|
||||
- locale
|
||||
@@ -128,7 +128,7 @@ cloud_config_modules:
|
||||
{% if variant in ["rhel"] %}
|
||||
- rh_subscription
|
||||
{% endif %}
|
||||
-{% if variant in ["rhel", "fedora", "photon"] %}
|
||||
+{% if variant in ["almalinux", "rhel", "fedora", "photon"] %}
|
||||
{% if variant not in ["photon"] %}
|
||||
- spacewalk
|
||||
{% endif %}
|
||||
@@ -275,7 +275,7 @@ system_info:
|
||||
groups: [adm, sudo]
|
||||
{% elif variant == "arch" %}
|
||||
groups: [wheel, users]
|
||||
-{% elif variant == "rhel" %}
|
||||
+{% elif variant in ["almalinux", "rhel"] %}
|
||||
groups: [adm, systemd-journal]
|
||||
{% else %}
|
||||
groups: [wheel, adm, systemd-journal]
|
||||
diff --git a/packages/pkg-deps.json b/packages/pkg-deps.json
|
||||
index eaf1346..0c22fd4 100644
|
||||
--- a/packages/pkg-deps.json
|
||||
+++ b/packages/pkg-deps.json
|
||||
@@ -13,6 +13,20 @@
|
||||
"procps"
|
||||
]
|
||||
},
|
||||
+ "almalinux" : {
|
||||
+ "build-requires" : [
|
||||
+ "python3-devel"
|
||||
+ ],
|
||||
+ "requires" : [
|
||||
+ "e2fsprogs",
|
||||
+ "iproute",
|
||||
+ "net-tools",
|
||||
+ "procps",
|
||||
+ "rsyslog",
|
||||
+ "shadow-utils",
|
||||
+ "sudo"
|
||||
+ ]
|
||||
+ },
|
||||
"centos" : {
|
||||
"build-requires" : [
|
||||
"python3-devel"
|
||||
diff --git a/systemd/cloud-config.service.tmpl b/systemd/cloud-config.service.tmpl
|
||||
index d5568a6..4b88f83 100644
|
||||
--- a/systemd/cloud-config.service.tmpl
|
||||
+++ b/systemd/cloud-config.service.tmpl
|
||||
@@ -4,7 +4,7 @@ Description=Apply the settings specified in cloud-config
|
||||
After=network-online.target cloud-config.target
|
||||
After=snapd.seeded.service
|
||||
Wants=network-online.target cloud-config.target
|
||||
-{% if variant == "rhel" %}
|
||||
+{% if variant in ["almalinux", "rhel"] %}
|
||||
ConditionPathExists=!/etc/cloud/cloud-init.disabled
|
||||
ConditionKernelCommandLine=!cloud-init=disabled
|
||||
{% endif %}
|
||||
diff --git a/systemd/cloud-final.service.tmpl b/systemd/cloud-final.service.tmpl
|
||||
index 85f423a..aa5990c 100644
|
||||
--- a/systemd/cloud-final.service.tmpl
|
||||
+++ b/systemd/cloud-final.service.tmpl
|
||||
@@ -7,7 +7,7 @@ After=multi-user.target
|
||||
Before=apt-daily.service
|
||||
{% endif %}
|
||||
Wants=network-online.target cloud-config.service
|
||||
-{% if variant == "rhel" %}
|
||||
+{% if variant in ["almalinux", "rhel"] %}
|
||||
ConditionPathExists=!/etc/cloud/cloud-init.disabled
|
||||
ConditionKernelCommandLine=!cloud-init=disabled
|
||||
{% endif %}
|
||||
@@ -19,7 +19,7 @@ ExecStart=/usr/bin/cloud-init modules --mode=final
|
||||
RemainAfterExit=yes
|
||||
TimeoutSec=0
|
||||
KillMode=process
|
||||
-{% if variant == "rhel" %}
|
||||
+{% if variant in ["almalinux", "rhel"] %}
|
||||
# Restart NetworkManager if it is present and running.
|
||||
ExecStartPost=/bin/sh -c 'u=NetworkManager.service; \
|
||||
out=$(systemctl show --property=SubState $u) || exit; \
|
||||
diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl
|
||||
index a6b8265..29ac717 100644
|
||||
--- a/systemd/cloud-init-local.service.tmpl
|
||||
+++ b/systemd/cloud-init-local.service.tmpl
|
||||
@@ -1,23 +1,23 @@
|
||||
## template:jinja
|
||||
[Unit]
|
||||
Description=Initial cloud-init job (pre-networking)
|
||||
-{% if variant in ["ubuntu", "unknown", "debian", "rhel" ] %}
|
||||
+{% if variant in ["almalinux", "ubuntu", "unknown", "debian", "rhel" ] %}
|
||||
DefaultDependencies=no
|
||||
{% endif %}
|
||||
Wants=network-pre.target
|
||||
After=hv_kvp_daemon.service
|
||||
After=systemd-remount-fs.service
|
||||
-{% if variant == "rhel" %}
|
||||
+{% if variant in ["almalinux", "rhel"] %}
|
||||
Requires=dbus.socket
|
||||
After=dbus.socket
|
||||
{% endif %}
|
||||
Before=NetworkManager.service
|
||||
-{% if variant == "rhel" %}
|
||||
+{% if variant in ["almalinux", "rhel"] %}
|
||||
Before=network.service
|
||||
{% endif %}
|
||||
Before=network-pre.target
|
||||
Before=shutdown.target
|
||||
-{% if variant == "rhel" %}
|
||||
+{% if variant in ["almalinux", "rhel"] %}
|
||||
Before=firewalld.target
|
||||
Conflicts=shutdown.target
|
||||
{% endif %}
|
||||
@@ -26,14 +26,14 @@ Before=sysinit.target
|
||||
Conflicts=shutdown.target
|
||||
{% endif %}
|
||||
RequiresMountsFor=/var/lib/cloud
|
||||
-{% if variant == "rhel" %}
|
||||
+{% if variant in ["almalinux", "rhel"] %}
|
||||
ConditionPathExists=!/etc/cloud/cloud-init.disabled
|
||||
ConditionKernelCommandLine=!cloud-init=disabled
|
||||
{% endif %}
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
-{% if variant == "rhel" %}
|
||||
+{% if variant in ["almalinux", "rhel"] %}
|
||||
ExecStartPre=/bin/mkdir -p /run/cloud-init
|
||||
ExecStartPre=/sbin/restorecon /run/cloud-init
|
||||
ExecStartPre=/usr/bin/touch /run/cloud-init/enabled
|
||||
diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
|
||||
index c170aef..08da708 100644
|
||||
--- a/systemd/cloud-init.service.tmpl
|
||||
+++ b/systemd/cloud-init.service.tmpl
|
||||
@@ -1,7 +1,7 @@
|
||||
## template:jinja
|
||||
[Unit]
|
||||
Description=Initial cloud-init job (metadata service crawler)
|
||||
-{% if variant not in ["photon", "rhel"] %}
|
||||
+{% if variant not in ["almalinux", "photon", "rhel"] %}
|
||||
DefaultDependencies=no
|
||||
{% endif %}
|
||||
Wants=cloud-init-local.service
|
||||
@@ -36,7 +36,7 @@ Before=shutdown.target
|
||||
Conflicts=shutdown.target
|
||||
{% endif %}
|
||||
Before=systemd-user-sessions.service
|
||||
-{% if variant == "rhel" %}
|
||||
+{% if variant in ["almalinux", "rhel"] %}
|
||||
ConditionPathExists=!/etc/cloud/cloud-init.disabled
|
||||
ConditionKernelCommandLine=!cloud-init=disabled
|
||||
{% endif %}
|
||||
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
|
||||
index 591241b..05aa3f9 100644
|
||||
--- a/tests/unittests/test_net.py
|
||||
+++ b/tests/unittests/test_net.py
|
||||
@@ -6254,6 +6254,7 @@ class TestNetRenderers(CiTestCase):
|
||||
def test_sysconfig_available_uses_variant_mapping(self, m_info, m_avail):
|
||||
m_avail.return_value = True
|
||||
variants = [
|
||||
+ "almalinux",
|
||||
"suse",
|
||||
"centos",
|
||||
"eurolinux",
|
||||
diff --git a/tests/unittests/test_render_cloudcfg.py b/tests/unittests/test_render_cloudcfg.py
|
||||
index 9f95d44..f1844e9 100644
|
||||
--- a/tests/unittests/test_render_cloudcfg.py
|
||||
+++ b/tests/unittests/test_render_cloudcfg.py
|
||||
@@ -9,6 +9,7 @@ from tests.unittests.helpers import cloud_init_project_dir
|
||||
|
||||
# TODO(Look to align with tools.render-cloudcfg or cloudinit.distos.OSFAMILIES)
|
||||
DISTRO_VARIANTS = [
|
||||
+ "almalinux",
|
||||
"amazon",
|
||||
"arch",
|
||||
"centos",
|
||||
@@ -66,6 +67,7 @@ class TestRenderCloudCfg:
|
||||
system_cfg = util.load_yaml(stream.read())
|
||||
|
||||
default_user_exceptions = {
|
||||
+ "almalinux": "almalinux",
|
||||
"amazon": "ec2-user",
|
||||
"debian": "ubuntu",
|
||||
"rhel": "cloud-user",
|
||||
diff --git a/tools/read-dependencies b/tools/read-dependencies
|
||||
index efa5879..4f0953e 100755
|
||||
--- a/tools/read-dependencies
|
||||
+++ b/tools/read-dependencies
|
||||
@@ -22,6 +22,7 @@ DEFAULT_REQUIREMENTS = 'requirements.txt'
|
||||
|
||||
# Map the appropriate package dir needed for each distro choice
|
||||
DISTRO_PKG_TYPE_MAP = {
|
||||
+ 'almalinux': 'redhat',
|
||||
'centos': 'redhat',
|
||||
'eurolinux': 'redhat',
|
||||
'miraclelinux': 'redhat',
|
||||
@@ -68,6 +69,7 @@ ZYPPER_INSTALL = [
|
||||
'--auto-agree-with-licenses']
|
||||
|
||||
DRY_DISTRO_INSTALL_PKG_CMD = {
|
||||
+ 'almalinux': ['yum', 'install', '--assumeyes'],
|
||||
'rocky': ['yum', 'install', '--assumeyes'],
|
||||
'centos': ['yum', 'install', '--assumeyes'],
|
||||
'eurolinux': ['yum', 'install', '--assumeyes'],
|
||||
@@ -76,6 +78,7 @@ DRY_DISTRO_INSTALL_PKG_CMD = {
|
||||
}
|
||||
|
||||
DISTRO_INSTALL_PKG_CMD = {
|
||||
+ 'almalinux': MAYBE_RELIABLE_YUM_INSTALL,
|
||||
'rocky': MAYBE_RELIABLE_YUM_INSTALL,
|
||||
'eurolinux': MAYBE_RELIABLE_YUM_INSTALL,
|
||||
'miraclelinux': MAYBE_RELIABLE_YUM_INSTALL,
|
||||
@@ -90,6 +93,7 @@ DISTRO_INSTALL_PKG_CMD = {
|
||||
|
||||
# List of base system packages required to enable ci automation
|
||||
CI_SYSTEM_BASE_PKGS = {
|
||||
+ 'almalinux': ['python3-tox'],
|
||||
'common': ['make', 'sudo', 'tar'],
|
||||
'eurolinux': ['python3-tox'],
|
||||
'miraclelinux': ['python3-tox'],
|
||||
@@ -285,7 +289,7 @@ def pkg_install(pkg_list, distro, test_distro=False, dry_run=False):
|
||||
cmd = DRY_DISTRO_INSTALL_PKG_CMD[distro]
|
||||
install_cmd.extend(cmd)
|
||||
|
||||
- if distro in ['centos', 'redhat', 'rocky', 'eurolinux']:
|
||||
+ if distro in ['almalinux', 'centos', 'redhat', 'rocky', 'eurolinux']:
|
||||
# CentOS and Redhat need epel-release to access oauthlib and jsonschema
|
||||
subprocess.check_call(install_cmd + ['epel-release'])
|
||||
if distro in ['suse', 'opensuse', 'redhat', 'rocky', 'centos', 'eurolinux']:
|
||||
--
|
||||
2.37.3
|
||||
|
@ -47,7 +47,7 @@ Patch13: ci-Revert-Add-native-NetworkManager-support-1224.patch
|
||||
Patch14: ci-Revert-Use-Network-Manager-and-Netplan-as-default-re.patch
|
||||
|
||||
# AlmaLinux patches
|
||||
Patch100: 0001-Fix-the-Yum-Add-Repo-module-for-AlmaLinux-OS.patch
|
||||
Patch100: 0001-Improve-AlmaLinux-OS-support-and-compatibility.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user