288 lines
11 KiB
Diff
288 lines
11 KiB
Diff
From e921be03f802ee154ed1ddf044e276b23af0d2b6 Mon Sep 17 00:00:00 2001
|
|
From: Darren Archibald <darren.archibald@oracle.com>
|
|
Date: Fri, 23 Feb 2024 07:52:25 -0800
|
|
Subject: [PATCH] Add Oracle to distro detection logic in cloud.cfg.tmpl
|
|
|
|
Oracle Linux is being detected as "ol" variant by cloud-init.
|
|
This patch adds "ol" to the list of supported variants, and applies needed settings to it.
|
|
You can notice that variant "ol" is being set as distro "rhel" in a couple of places,
|
|
that is expected as this designated that base distro for "ol" is "rhel" ( which is true )
|
|
|
|
The main reason for this change is that cloud-init package dropped hardcoded configs that set OL as rhel
|
|
and to make cloud-init behave on OL systems as expected we need to add "ol" designation to supported list.
|
|
|
|
Orabug: 34845400
|
|
Signed-off-by: Alex Burmashev <alexander.burmashev@oracle.com>
|
|
Signed-off-by: Darren Archibald <darren.archibald@oracle.com>
|
|
Signed-off-by: Rajesh Harekal <rajesh.harekal@oracle.com>
|
|
---
|
|
cloudinit/distros/__init__.py | 1 +
|
|
cloudinit/sources/DataSourceRbxCloud.py | 2 +-
|
|
config/cloud.cfg.tmpl | 33 ++++++++++++++++++-------
|
|
systemd/cloud-final.service | 4 ++-
|
|
systemd/cloud-init-local.service.tmpl | 12 ++++++---
|
|
systemd/cloud-init.service.tmpl | 8 ++++--
|
|
systemd/cloud-init-generator.tmpl | 1 +++--
|
|
tests/unittests/test_util.py | 1 +
|
|
8 files changed, 48 insertions(+), 17 deletions(-)
|
|
|
|
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
|
|
index 79e2623..8f1381b 100644
|
|
--- a/cloudinit/distros/__init__.py
|
|
+++ b/cloudinit/distros/__init__.py
|
|
@@ -78,6 +78,7 @@ OSFAMILIES = {
|
|
"rhel",
|
|
"rocky",
|
|
"virtuozzo",
|
|
+ "ol",
|
|
],
|
|
"suse": [
|
|
"opensuse",
|
|
diff --git a/cloudinit/sources/DataSourceRbxCloud.py b/cloudinit/sources/DataSourceRbxCloud.py
|
|
index 9214f1b..5379132 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 ["fedora", "centos", "rhel", "ol"]:
|
|
source_param = "-s"
|
|
for item in items:
|
|
try:
|
|
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
|
|
index a470120..f440830 100644
|
|
--- a/config/cloud.cfg.tmpl
|
|
+++ b/config/cloud.cfg.tmpl
|
|
@@ -59,10 +59,10 @@
|
|
{% endif %}
|
|
|
|
{%- if variant in ["alpine", "amazon", "fedora", "OpenCloudOS", "openeuler",
|
|
- "openmandriva", "photon", "TencentOS"] or is_rhel %}
|
|
+ "openmandriva", "photon", "TencentOS", "ol"] or is_rhel %}
|
|
|
|
-{% if is_rhel %}
|
|
-mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.after=cloud-init-network.service,_netdev', '0', '2']
|
|
+{% if variant in ["ol"] or is_rhel %}
|
|
+mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.after=cloud-init.service,_netdev', '0', '2']
|
|
{% else %}
|
|
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
|
|
{% endif %}
|
|
@@ -101,7 +101,7 @@
|
|
|
|
{% endif -%}
|
|
|
|
-{% if is_rhel %}
|
|
+{% if variant in ["ol"] or is_rhel %}
|
|
# Default redhat settings:
|
|
ssh_deletekeys: true
|
|
ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519']
|
|
@@ -166,18 +166,20 @@
|
|
- ubuntu_pro
|
|
{% endif %}
|
|
{% elif variant in ["azurelinux", "fedora", "mariner", "openeuler",
|
|
- "openmandriva", "photon"] or is_rhel %}
|
|
+ "openmandriva", "photon", "ol"] or is_rhel %}
|
|
{% if is_rhel %}
|
|
- rh_subscription
|
|
{% endif %}
|
|
-{% if variant not in ["azurelinux", "mariner", "photon"] %}
|
|
+{% if variant not in ["azurelinux", "mariner", "photon", "ol"] %}
|
|
- spacewalk
|
|
{% endif %}
|
|
- yum_add_repo
|
|
{% elif variant == "suse" %}
|
|
- zypper_add_repo
|
|
{% endif %}
|
|
+{% if variant not in ["ol"] %}
|
|
- ntp
|
|
+{% endif %}
|
|
- timezone
|
|
{% if variant not in ["azurelinux"] %}
|
|
- disable_ec2_metadata
|
|
@@ -207,6 +209,8 @@
|
|
{% if variant not in ["azurelinux"] %}
|
|
- mcollective
|
|
- salt_minion
|
|
+{% endif %}
|
|
+{% if variant not in ["azurelinux", "ol"] %}
|
|
- reset_rmc
|
|
{% endif %}
|
|
- scripts_vendor
|
|
@@ -230,6 +234,8 @@
|
|
"OpenCloudOS", "openeuler", "openmandriva", "photon", "suse",
|
|
"TencentOS", "ubuntu"] or is_rhel %}
|
|
distro: {{ variant }}
|
|
+{% elif variant == "ol" %}
|
|
+ distro: rhel
|
|
{% elif variant == "dragonfly" %}
|
|
distro: dragonflybsd
|
|
{% else %}
|
|
@@ -238,7 +244,9 @@
|
|
{% endif %}
|
|
# Default user name + that default users groups (if added/used)
|
|
default_user:
|
|
-{% if variant in usernames %}
|
|
+{% if variant == "ol" %}
|
|
+ name: cloud-user
|
|
+{% elif variant in usernames %}
|
|
name: {{ usernames[variant] }}
|
|
{% else %}
|
|
name: {{ variant }}
|
|
@@ -246,11 +254,13 @@
|
|
{% if variant in ["alpine", "amazon", "aosc", "arch", "azurelinux", "debian", "fedora",
|
|
"gentoo", "mariner", "OpenCloudOS", "openeuler",
|
|
"openmandriva", "photon", "suse", "TencentOS", "ubuntu",
|
|
- "unknown"]
|
|
+ "unknown", "ol"]
|
|
or is_bsd or is_rhel %}
|
|
lock_passwd: True
|
|
{% endif %}
|
|
-{% if variant in gecos %}
|
|
+{% if variant == "ol" %}
|
|
+ gecos: Cloud User
|
|
+{% elif variant in gecos %}
|
|
gecos: {{ gecos[variant] }}
|
|
{% else %}
|
|
gecos: {{ variant }} Cloud User
|
|
@@ -259,7 +269,7 @@
|
|
groups: [{{ groups[variant] }}]
|
|
{% elif is_bsd %}
|
|
groups: [wheel]
|
|
-{% elif is_rhel %}
|
|
+{% elif variant in ["ol"] or is_rhel %}
|
|
groups: [adm, systemd-journal]
|
|
{% else %}
|
|
groups: [wheel, adm, systemd-journal]
|
|
@@ -328,7 +338,7 @@
|
|
{% if variant in ["alpine", "amazon", "aosc", "arch", "azurelinux", "debian", "fedora",
|
|
"gentoo", "mariner", "OpenCloudOS", "openeuler",
|
|
"openmandriva", "photon", "suse", "TencentOS", "ubuntu",
|
|
- "unknown"]
|
|
+ "unknown", "ol"]
|
|
or is_rhel %}
|
|
# Other config here will be given to the distro class and/or path classes
|
|
paths:
|
|
@@ -375,7 +385,7 @@
|
|
ssh_svcname: ssh
|
|
{% elif variant in ["alpine", "amazon", "aosc", "arch", "azurelinux", "fedora",
|
|
"gentoo", "mariner", "OpenCloudOS", "openeuler",
|
|
- "openmandriva", "photon", "suse", "TencentOS"]
|
|
+ "openmandriva", "photon", "suse", "TencentOS", "ol"]
|
|
or is_rhel %}
|
|
ssh_svcname: sshd
|
|
{% endif %}
|
|
|
|
diff --git a/systemd/cloud-final.service b/systemd/cloud-final.service
|
|
index ab3daed..1c69dde 100644
|
|
--- a/systemd/cloud-final.service
|
|
+++ b/systemd/cloud-final.service
|
|
@@ -3,7 +3,6 @@
|
|
Description=Cloud-init: Final Stage
|
|
After=network-online.target time-sync.target cloud-config.service rc-local.service
|
|
After=multi-user.target
|
|
-Before=apt-daily.service
|
|
Wants=network-online.target cloud-config.service
|
|
ConditionPathExists=!/etc/cloud/cloud-init.disabled
|
|
ConditionKernelCommandLine=!cloud-init=disabled
|
|
|
|
diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl
|
|
index 3a1ca7f..4750c36 100644
|
|
--- a/systemd/cloud-init-local.service.tmpl
|
|
+++ b/systemd/cloud-init-local.service.tmpl
|
|
@@ -2,19 +2,21 @@
|
|
[Unit]
|
|
# https://docs.cloud-init.io/en/latest/explanation/boot.html
|
|
Description=Cloud-init: Local Stage (pre-network)
|
|
-{% if variant in ["almalinux", "cloudlinux", "ubuntu", "unknown", "debian", "rhel"] %}
|
|
+{% if variant in ["almalinux", "cloudlinux", "ubuntu", "unknown", "debian", "rhel", "ol"] %}
|
|
DefaultDependencies=no
|
|
{% endif %}
|
|
Wants=network-pre.target
|
|
+{% if variant not in ["ol"] %}
|
|
After=hv_kvp_daemon.service
|
|
-{% if variant in ["almalinux", "cloudlinux", "rhel"] %}
|
|
+{% endif %}
|
|
+{% if variant in ["almalinux", "cloudlinux", "rhel", "ol"] %}
|
|
Requires=dbus.socket
|
|
After=dbus.socket
|
|
{% endif %}
|
|
After=systemd-remount-fs.service
|
|
Before=network-pre.target
|
|
Before=shutdown.target
|
|
-{% if variant in ["almalinux", "cloudlinux", "rhel"] %}
|
|
+{% if variant in ["almalinux", "cloudlinux", "rhel", "ol"] %}
|
|
Before=firewalld.target
|
|
{% endif %}
|
|
{% if variant in ["ubuntu", "unknown", "debian"] %}
|
|
@@ -28,7 +30,7 @@
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
-{% if variant in ["almalinux", "cloudlinux", "rhel"] %}
|
|
+{% if variant in ["almalinux", "cloudlinux", "rhel", "ol"] %}
|
|
ExecStartPre=/sbin/restorecon /run/cloud-init
|
|
{% endif %}
|
|
ExecStart=/usr/bin/cloud-init init --local
|
|
|
|
diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
|
|
index 90d45f2..2e1ce48 100644
|
|
--- a/systemd/cloud-init.service.tmpl
|
|
+++ b/systemd/cloud-init.service.tmpl
|
|
@@ -2,7 +2,7 @@
|
|
[Unit]
|
|
# https://docs.cloud-init.io/en/latest/explanation/boot.html
|
|
Description=Cloud-init: Network Stage
|
|
-{% if variant not in ["almalinux", "cloudlinux", "photon", "rhel"] %}
|
|
+{% if variant not in ["almalinux", "cloudlinux", "photon", "rhel", "ol"] %}
|
|
DefaultDependencies=no
|
|
{% endif %}
|
|
Wants=cloud-init-local.service
|
|
@@ -11,13 +11,15 @@
|
|
Wants=sshd-keygen@ed25519.service
|
|
Wants=sshd.service
|
|
After=cloud-init-local.service
|
|
+{% if variant not in ["ol"] %}
|
|
After=systemd-networkd-wait-online.service
|
|
+{% endif %}
|
|
{% if variant in ["ubuntu", "unknown", "debian"] %}
|
|
After=networking.service
|
|
{% endif %}
|
|
{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora",
|
|
"miraclelinux", "openeuler", "OpenCloudOS", "openmandriva", "rhel", "rocky",
|
|
- "suse", "TencentOS", "virtuozzo"] %}
|
|
+ "suse", "TencentOS", "virtuozzo", "ol"] %}
|
|
|
|
After=NetworkManager.service
|
|
After=NetworkManager-wait-online.service
|
|
|
|
diff --git a/systemd/cloud-init-generator.tmpl b/systemd/cloud-init-generator.tmpl
|
|
--- a/systemd/cloud-init-generator.tmpl
|
|
+++ b/systemd/cloud-init-generator.tmpl
|
|
@@ -21,7 +21,7 @@
|
|
CLOUD_SYSTEM_TARGET="/lib/systemd/system/cloud-init.target"
|
|
{% endif %}
|
|
{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora",
|
|
- "miraclelinux", "openeuler", "OpenCloudOS", "openmandriva", "rhel", "rocky", "TencentOS", "virtuozzo"] %}
|
|
+ "miraclelinux", "openeuler", "OpenCloudOS", "openmandriva", "rhel", "rocky", "TencentOS", "virtuozzo", "ol"] %}
|
|
dsidentify="/usr/libexec/cloud-init/ds-identify"
|
|
{% elif variant == "benchmark" %}
|
|
dsidentify="/bin/true"
|
|
|
|
diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py
|
|
index 519ef63..323e7f6 100644
|
|
--- a/tests/unittests/test_util.py
|
|
+++ b/tests/unittests/test_util.py
|
|
@@ -1311,6 +1311,7 @@ class TestGetVariant:
|
|
({"system": "linux", "dist": ("sles",)}, "suse"),
|
|
({"system": "linux", "dist": ("sle_hpc",)}, "suse"),
|
|
({"system": "linux", "dist": ("my_distro",)}, "linux"),
|
|
+ ({"system": "linux", "dist": ("ol",)}, "ol"),
|
|
({"system": "Windows", "dist": ("dontcare",)}, "windows"),
|
|
({"system": "Darwin", "dist": ("dontcare",)}, "darwin"),
|
|
({"system": "Freebsd", "dist": ("dontcare",)}, "freebsd"),
|
|
--
|
|
2.31.1
|
|
|