From 54caf3efaea08a24795b7af5d894717e363fa971 Mon Sep 17 00:00:00 2001 From: Elkhan Mammadli Date: Fri, 14 Mar 2025 00:02:45 +0400 Subject: [PATCH] fix: fix almalinux and cloudlinux support Signed-off-by: Elkhan Mammadli --- ...s-for-AlmaLinux-OS-and-CloudLinux-OS.patch | 115 +++++------------- 1 file changed, 31 insertions(+), 84 deletions(-) diff --git a/SOURCES/0031-Improvements-for-AlmaLinux-OS-and-CloudLinux-OS.patch b/SOURCES/0031-Improvements-for-AlmaLinux-OS-and-CloudLinux-OS.patch index 1b3e71b..101693b 100644 --- a/SOURCES/0031-Improvements-for-AlmaLinux-OS-and-CloudLinux-OS.patch +++ b/SOURCES/0031-Improvements-for-AlmaLinux-OS-and-CloudLinux-OS.patch @@ -1,36 +1,25 @@ -From f4f100c0dddf1f11b239374a8dc452739b8e6a81 Mon Sep 17 00:00:00 2001 -From: Andrew Lukoshko -Date: Thu, 28 Mar 2024 14:24:08 +0000 -Subject: [PATCH] Improvements for AlmaLinux OS and CloudLinux OS +From 9c50c68c9f7868f7dce78abe26c996edfdc00721 Mon Sep 17 00:00:00 2001 +From: Elkhan Mammadli +Date: Thu, 13 Mar 2025 23:48:17 +0400 +Subject: [PATCH] fix: fix and improve almalinux and cloudlinux support -Add AlmaLinux OS and CloudLinux OS support to: +- Fix cc_ntp module. +- Add support to cc_ca_certs module. +- Improve support for systemd integration. -Modules: -- cc_ca_certs -- cc_ntp -- cc_resolv_conf - -Datasources: -- Rbx Cloud Datasource - -Systemd services: -- cloud-final.service -- cloud-init-local.service -- cloud-init.service +Signed-off-by: Elkhan Mammadli --- - cloudinit/config/cc_ca_certs.py | 8 ++++ - cloudinit/config/cc_ntp.py | 11 ++--- - cloudinit/config/cc_resolv_conf.py | 2 + - cloudinit/settings.py | 2 +- - cloudinit/sources/DataSourceRbxCloud.py | 2 +- - systemd/cloud-final.service.tmpl | 2 +- - systemd/cloud-init-local.service.tmpl | 10 ++-- - systemd/cloud-init.service.tmpl | 2 +- - templates/chrony.conf.almalinux.tmpl | 51 ++++++++++++++++++++ - templates/chrony.conf.cloudlinux.tmpl | 51 ++++++++++++++++++++ - templates/ntp.conf.almalinux.tmpl | 64 +++++++++++++++++++++++++ - templates/ntp.conf.cloudlinux.tmpl | 64 +++++++++++++++++++++++++ - 12 files changed, 252 insertions(+), 17 deletions(-) + cloudinit/config/cc_ca_certs.py | 8 ++++ + cloudinit/config/cc_ntp.py | 3 ++ + cloudinit/settings.py | 2 +- + systemd/cloud-final.service.tmpl | 2 +- + systemd/cloud-init-local.service.tmpl | 10 ++--- + systemd/cloud-init.service.tmpl | 2 +- + templates/chrony.conf.almalinux.tmpl | 51 +++++++++++++++++++++ + templates/chrony.conf.cloudlinux.tmpl | 51 +++++++++++++++++++++ + templates/ntp.conf.almalinux.tmpl | 64 +++++++++++++++++++++++++++ + templates/ntp.conf.cloudlinux.tmpl | 64 +++++++++++++++++++++++++++ + 10 files changed, 249 insertions(+), 8 deletions(-) create mode 100644 templates/chrony.conf.almalinux.tmpl create mode 100644 templates/chrony.conf.cloudlinux.tmpl create mode 100644 templates/ntp.conf.almalinux.tmpl @@ -63,48 +52,19 @@ index 8d3fd9a..4dd5843 100644 "debian", "fedora", diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py -index 9eef24f..1015d43 100644 +index 9eef24f..4081d87 100644 --- a/cloudinit/config/cc_ntp.py +++ b/cloudinit/config/cc_ntp.py -@@ -109,14 +109,6 @@ DISTRO_CLIENT_CONFIG = { - "service_name": "ntpd", - }, - }, -- "centos": { -- "ntp": { -- "service_name": "ntpd", -- }, -- "chrony": { -- "service_name": "chronyd", -- }, -- }, - "cos": { - "chrony": { - "service_name": "chronyd", -@@ -224,6 +216,9 @@ DISTRO_CLIENT_CONFIG = { +@@ -224,6 +224,9 @@ DISTRO_CLIENT_CONFIG = { for distro in ("opensuse-microos", "opensuse-tumbleweed", "opensuse-leap"): DISTRO_CLIENT_CONFIG[distro] = DISTRO_CLIENT_CONFIG["opensuse"] -+for distro in ("almalinux", "centos", "cloudlinux"): ++for distro in ("almalinux", "cloudlinux", "rocky"): + DISTRO_CLIENT_CONFIG[distro] = DISTRO_CLIENT_CONFIG["rhel"] + for distro in ("sle_hpc", "sle-micro"): DISTRO_CLIENT_CONFIG[distro] = DISTRO_CLIENT_CONFIG["sles"] -diff --git a/cloudinit/config/cc_resolv_conf.py b/cloudinit/config/cc_resolv_conf.py -index aa88919..4eb1d76 100644 ---- a/cloudinit/config/cc_resolv_conf.py -+++ b/cloudinit/config/cc_resolv_conf.py -@@ -57,7 +57,9 @@ meta: MetaSchema = { - "title": "Configure resolv.conf", - "description": MODULE_DESCRIPTION, - "distros": [ -+ "almalinux", - "alpine", -+ "cloudlinux", - "fedora", - "mariner", - "opensuse", diff --git a/cloudinit/settings.py b/cloudinit/settings.py index 5ced21b..51cb115 100644 --- a/cloudinit/settings.py @@ -118,19 +78,6 @@ index 5ced21b..51cb115 100644 "network": {"renderers": None}, }, "vendor_data": {"enabled": True, "prefix": []}, -diff --git a/cloudinit/sources/DataSourceRbxCloud.py b/cloudinit/sources/DataSourceRbxCloud.py -index 9214f1b..14880ec 100644 ---- a/cloudinit/sources/DataSourceRbxCloud.py -+++ b/cloudinit/sources/DataSourceRbxCloud.py -@@ -60,7 +60,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", "cloudlinux", "rhel"]: - source_param = "-s" - for item in items: - try: diff --git a/systemd/cloud-final.service.tmpl b/systemd/cloud-final.service.tmpl index bcf8b00..6d34761 100644 --- a/systemd/cloud-final.service.tmpl @@ -145,7 +92,7 @@ index bcf8b00..6d34761 100644 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 3a1ca7f..853ae2c 100644 +index 3a1ca7f..cac3216 100644 --- a/systemd/cloud-init-local.service.tmpl +++ b/systemd/cloud-init-local.service.tmpl @@ -1,23 +1,23 @@ @@ -153,7 +100,7 @@ index 3a1ca7f..853ae2c 100644 [Unit] Description=Initial cloud-init job (pre-networking) -{% if variant in ["ubuntu", "unknown", "debian", "rhel" ] %} -+{% if variant in ["almalinux", "cloudlinux", "ubuntu", "unknown", "debian", "rhel" ] %} ++{% if variant in ["almalinux", "cloudlinux", "ubuntu", "unknown", "debian", "rhel"] %} DefaultDependencies=no {% endif %} Wants=network-pre.target @@ -314,7 +261,7 @@ index 0000000..43b1f5d +#log measurements statistics tracking diff --git a/templates/ntp.conf.almalinux.tmpl b/templates/ntp.conf.almalinux.tmpl new file mode 100644 -index 0000000..9884df5 +index 0000000..6d166aa --- /dev/null +++ b/templates/ntp.conf.almalinux.tmpl @@ -0,0 +1,64 @@ @@ -333,7 +280,7 @@ index 0000000..9884df5 +# Permit all access over the loopback interface. This could +# be tightened as well, but to do so would effect some of +# the administrative functions. -+restrict 127.0.0.1 ++restrict 127.0.0.1 +restrict -6 ::1 + +# Hosts on local network are less restricted. @@ -368,7 +315,7 @@ index 0000000..9884df5 +includefile /etc/ntp/crypto/pw + +# Key file containing the keys and key identifiers used when operating -+# with symmetric key cryptography. ++# with symmetric key cryptography. +keys /etc/ntp/keys + +# Specify the key identifiers which are trusted. @@ -384,7 +331,7 @@ index 0000000..9884df5 +#statistics clockstats cryptostats loopstats peerstats diff --git a/templates/ntp.conf.cloudlinux.tmpl b/templates/ntp.conf.cloudlinux.tmpl new file mode 100644 -index 0000000..9884df5 +index 0000000..6d166aa --- /dev/null +++ b/templates/ntp.conf.cloudlinux.tmpl @@ -0,0 +1,64 @@ @@ -403,7 +350,7 @@ index 0000000..9884df5 +# Permit all access over the loopback interface. This could +# be tightened as well, but to do so would effect some of +# the administrative functions. -+restrict 127.0.0.1 ++restrict 127.0.0.1 +restrict -6 ::1 + +# Hosts on local network are less restricted. @@ -438,7 +385,7 @@ index 0000000..9884df5 +includefile /etc/ntp/crypto/pw + +# Key file containing the keys and key identifiers used when operating -+# with symmetric key cryptography. ++# with symmetric key cryptography. +keys /etc/ntp/keys + +# Specify the key identifiers which are trusted. @@ -453,5 +400,5 @@ index 0000000..9884df5 +# Enable writing of statistics records. +#statistics clockstats cryptostats loopstats peerstats -- -2.27.0 +2.48.1