Enable Yum Add Repo module on AlmaLinux

This commit is contained in:
Andrew Lukoshko 2022-10-26 13:22:54 +00:00
parent 69cf60aaec
commit 4e7c7dd995
3 changed files with 31 additions and 187 deletions

View File

@ -0,0 +1,29 @@
From 68c9e63c581640667f23b87994c446a56136548a Mon Sep 17 00:00:00 2001
From: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
Date: Wed, 26 Oct 2022 16:37:21 +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 fb4b456..15747bb 100644
--- a/config/cloud.cfg.tmpl
+++ b/config/cloud.cfg.tmpl
@@ -111,7 +111,7 @@ cloud_config_modules:
- locale
{% endif %}
- set-passwords
-{% if variant in ["rhel", "fedora", "photon"] %}
+{% if variant in ["almalinux", "rhel", "fedora", "photon"] %}
{% if variant not in ["photon"] %}
- spacewalk
{% endif %}
--
2.37.3

View File

@ -1,185 +0,0 @@
From deccb70fbd4d0cf759732c6a59357f74ae1558e4 Mon Sep 17 00:00:00 2001
From: Andrew Lukoshko <andrew.lukoshko@gmail.com>
Date: Wed, 7 Apr 2021 23:50:49 +0300
Subject: [PATCH] Add AlmaLinux OS support
---
cloudinit/config/cc_ntp.py | 4 ++--
cloudinit/config/cc_yum_add_repo.py | 4 ++--
cloudinit/distros/__init__.py | 2 +-
cloudinit/distros/almalinux.py | 9 +++++++++
cloudinit/net/sysconfig.py | 2 +-
cloudinit/util.py | 4 ++--
config/cloud.cfg.tmpl | 6 +++---
systemd/cloud-init-generator.tmpl | 2 +-
systemd/cloud-init.service.tmpl | 2 +-
tools/.github-cla-signers | 1 +
tools/render-cloudcfg | 4 ++--
11 files changed, 25 insertions(+), 15 deletions(-)
create mode 100644 cloudinit/distros/almalinux.py
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index e183993f1d..41c278ffad 100644
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
@@ -24,8 +24,8 @@
frequency = PER_INSTANCE
NTP_CONF = '/etc/ntp.conf'
NR_POOL_SERVERS = 4
-distros = ['alpine', 'centos', 'debian', 'fedora', 'opensuse', 'rhel',
- 'sles', 'ubuntu']
+distros = ['almalinux', 'alpine', 'centos', 'debian', 'fedora', 'opensuse',
+ 'rhel', '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 01fe683cd1..db513ed7dc 100644
--- a/cloudinit/config/cc_yum_add_repo.py
+++ b/cloudinit/config/cc_yum_add_repo.py
@@ -18,7 +18,7 @@
**Module frequency:** per always
-**Supported distros:** centos, fedora, rhel
+**Supported distros:** almalinux, centos, fedora, rhel
**Config keys**::
@@ -36,7 +36,7 @@
from cloudinit import util
-distros = ['centos', 'fedora', 'rhel']
+distros = ['almalinux', 'centos', 'fedora', 'rhel']
def _canonicalize_id(repo_id):
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 220bd11f2c..2e1200c087 100755
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -46,7 +46,7 @@
'debian': ['debian', 'ubuntu'],
'freebsd': ['freebsd'],
'gentoo': ['gentoo'],
- 'redhat': ['amazon', 'centos', 'fedora', 'rhel'],
+ 'redhat': ['almalinux', 'amazon', 'centos', 'fedora', 'rhel'],
'suse': ['opensuse', 'sles'],
}
diff --git a/cloudinit/distros/almalinux.py b/cloudinit/distros/almalinux.py
new file mode 100644
index 0000000000..edb3165d2e
--- /dev/null
+++ b/cloudinit/distros/almalinux.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 99a4bae459..d732854d0c 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -19,7 +19,7 @@
LOG = logging.getLogger(__name__)
NM_CFG_FILE = "/etc/NetworkManager/NetworkManager.conf"
-KNOWN_DISTROS = ['centos', 'fedora', 'rhel', 'suse']
+KNOWN_DISTROS = ['almalinux', 'centos', 'fedora', 'rhel', 'suse']
def _make_header(sep='#'):
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 4e0a72db86..fdea1181c0 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -521,8 +521,8 @@ def system_info():
if system == "linux":
linux_dist = info['dist'][0].lower()
if linux_dist in (
- 'alpine', 'arch', 'centos', 'debian', 'fedora', 'rhel',
- 'suse'):
+ 'almalinux', 'alpine', 'arch', 'centos', 'debian', 'fedora',
+ 'rhel', '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 7171aaa514..8656daa72b 100644
--- a/config/cloud.cfg.tmpl
+++ b/config/cloud.cfg.tmpl
@@ -21,7 +21,7 @@ disable_root: false
disable_root: true
{% endif %}
-{% if variant in ["alpine", "amazon", "centos", "fedora", "rhel"] %}
+{% if variant in ["almalinux", "alpine", "amazon", "centos", "fedora", "rhel"] %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
{% if variant == "amazon" %}
resize_rootfs: noblock
@@ -153,7 +153,7 @@ cloud_final_modules:
# (not accessible to handlers/transforms)
system_info:
# This will affect which distro class gets used
-{% if variant in ["alpine", "amazon", "arch", "centos", "debian",
+{% if variant in ["almalinux", "alpine", "amazon", "arch", "centos", "debian",
"fedora", "freebsd", "netbsd", "openbsd", "rhel",
"suse", "ubuntu"] %}
distro: {{ variant }}
@@ -206,7 +206,7 @@ system_info:
primary: http://ports.ubuntu.com/ubuntu-ports
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
-{% elif variant in ["alpine", "amazon", "arch", "centos", "fedora",
+{% elif variant in ["almalinux", "alpine", "amazon", "arch", "centos", "fedora",
"rhel", "suse"] %}
# Default user name + that default users groups (if added/used)
default_user:
diff --git a/systemd/cloud-init-generator.tmpl b/systemd/cloud-init-generator.tmpl
index 0773356bb6..9b103ef983 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 ["rhel", "fedora", "centos"] %}
+{% if variant in ["almalinux", "rhel", "fedora", "centos"] %}
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 f140344db5..a5c5127715 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 ["centos", "fedora", "rhel"] %}
+{% if variant in ["almalinux", "centos", "fedora", "rhel"] %}
After=network.service
After=NetworkManager.service
{% endif %}
diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
index ed4548400d..f599074801 100755
--- a/tools/render-cloudcfg
+++ b/tools/render-cloudcfg
@@ -4,8 +4,8 @@ import argparse
import os
import sys
-VARIANTS = ["alpine", "amazon", "arch", "centos", "debian", "fedora",
- "freebsd", "netbsd", "openbsd", "rhel", "suse", "ubuntu",
+VARIANTS = ["almalinux", "alpine", "amazon", "arch", "centos", "debian",
+ "fedora", "freebsd", "netbsd", "openbsd", "rhel", "suse", "ubuntu",
"unknown"]

View File

@ -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: cloud-init-20.3-add_almalinux.patch
Patch100: 0001-Fix-the-Yum-Add-Repo-module-for-AlmaLinux-OS.patch
BuildArch: noarch
@ -233,7 +233,7 @@ fi
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
%changelog
* Fri Apr 01 2022 Eduard Abdullin <eabdullin@almalinux.org> - 22.1-5.alma
* Wed Oct 26 2022 Eduard Abdullin <eabdullin@almalinux.org> - 22.1-5.alma
- AlmaLinux changes
* Wed Aug 17 2022 Jon Maloy <jmaloy@redhat.com> - 22.1-5