diff --git a/ci-cloud.cfg.tmpl-make-sure-centos-settings-are-identic.patch b/ci-cloud.cfg.tmpl-make-sure-centos-settings-are-identic.patch new file mode 100644 index 0000000..df94668 --- /dev/null +++ b/ci-cloud.cfg.tmpl-make-sure-centos-settings-are-identic.patch @@ -0,0 +1,139 @@ +From dd5ae3081491a2a98bd74e1655b22c9354707630 Mon Sep 17 00:00:00 2001 +From: Emanuele Giuseppe Esposito +Date: Thu, 8 Sep 2022 17:46:45 +0200 +Subject: [PATCH] cloud.cfg.tmpl: make sure "centos" settings are identical to + "rhel" (#1639) + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2115576 + +commit 7593243a1abe2ccaf4698579720999380a4da73b +Author: Emanuele Giuseppe Esposito +Date: Wed Sep 7 14:53:26 2022 +0200 + + cloud.cfg.tmpl: make sure "centos" settings are identical to "rhel" (#1639) + + We have a couple of bugs where centos does not have the default user as rhel. + This PR makes sure the configuration is exactly the same. + + Signed-off-by: Emanuele Giuseppe Esposito + + RHBZ: 2115565 + RHBZ: 2115576 + Conflicts: + config/cloud.cfg.tmpl: "openmandriva" distro added in the options + +Signed-off-by: Emanuele Giuseppe Esposito +--- + 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 80ab4f96..08b6efbc 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"] %} + {% 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 9f95d448..1a6e2715 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.37.3 + diff --git a/cloud-init.spec b/cloud-init.spec index f0f9c43..7081ba2 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,6 +1,6 @@ Name: cloud-init Version: 22.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Cloud instance init scripts License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init @@ -46,6 +46,8 @@ Patch17: ci-Revert-Use-Network-Manager-and-Netplan-as-default-re.patch # For bz#2117532 - [RHEL9.1] Revert patch of configuring networking by NM keyfiles # For bz#2098501 - [RHEL-9.1] IPv6 not workable when cloud-init configure network using NM keyfiles Patch18: ci-Revert-Revert-Setting-highest-autoconnect-priority-f.patch +# For bz#2115565 - cloud-init configures user "centos" or "rhel" instead of "cloud-user" with cloud-init-22.1 +Patch19: ci-cloud.cfg.tmpl-make-sure-centos-settings-are-identic.patch # Source-git patches @@ -236,6 +238,11 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog +* Tue Sep 27 2022 Camilla Conte - 22.1-6 +- ci-cloud.cfg.tmpl-make-sure-centos-settings-are-identic.patch [bz#2115565] +- Resolves: bz#2115565 + (cloud-init configures user "centos" or "rhel" instead of "cloud-user" with cloud-init-22.1) + * Wed Aug 17 2022 Miroslav Rezanina - 22.1-5 - ci-Revert-Add-native-NetworkManager-support-1224.patch [bz#2107463 bz#2104389 bz#2117532 bz#2098501] - ci-Revert-Use-Network-Manager-and-Netplan-as-default-re.patch [bz#2107463 bz#2104389 bz#2117532 bz#2098501]