* Mon Feb 10 2025 Jon Maloy <jmaloy@redhat.com> - 24.4-3

- ci-Use-log_with_downgradable_level-for-user-password-wa.patch [RHEL-71122]
- ci-downstream-set-deprecation-boundary-version.patch [RHEL-71122]
- Resolves: RHEL-71122
  (Suggest to change some log messages from warning to info after rebase cloud-init-24.4 [RHEL-9.6] )
This commit is contained in:
Jon Maloy 2025-02-10 23:38:30 -05:00
parent e9ef618b3a
commit f7be84a001
3 changed files with 147 additions and 1 deletions

View File

@ -0,0 +1,97 @@
From 8a2e39a44ee0b6154fbb58eeb624d460b3489302 Mon Sep 17 00:00:00 2001
From: Ani Sinha <anisinha@redhat.com>
Date: Fri, 10 Jan 2025 23:32:52 +0530
Subject: [PATCH 1/2] Use log_with_downgradable_level for user password
warnings (#5927)
RH-Author: xiachen <xiachen@redhat.com>
RH-MergeRequest: 121: Use log_with_downgradable_level for user password warnings (#5927)
RH-Jira: RHEL-71122
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
RH-Commit: [1/2] 313b086475c07865898c9a29991fa8bf5359fea6 (xiachen/cloud-init-centos)
Introduction of new WARNING level logs could be problematic for stable
downstream distros. Customers using these distros would then see a new and
unexpected behavior change or a new WARNING log that can confuse them. So for
handling user account passwords, use log_with_downgradable_level() helper api
instead so that downstream distros can maintain stability while also making
progressive changes in upstream towards improved user experience.
Downstream distros can convert these logs to DEBUG level by setting
DEPRECATION_INFO_BOUNDARY to a value older than the cloud-init version at which
these logs were first introduced (24.3). Please see the documentation for
log_with_downgradable_level().
Signed-off-by: Ani Sinha <anisinha@redhat.com>
(cherry picked from commit 38acce473626dc749dfb8bf3602e294df554c781)
Signed-off-by: Amy Chen <xiachen@redhat.com>
---
cloudinit/distros/__init__.py | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 34c0836e8..020d2201d 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -50,6 +50,7 @@ from cloudinit.distros.package_management.package_manager import PackageManager
from cloudinit.distros.package_management.utils import known_package_managers
from cloudinit.distros.parsers import hosts
from cloudinit.features import ALLOW_EC2_MIRRORS_ON_NON_AWS_INSTANCE_TYPES
+from cloudinit.lifecycle import log_with_downgradable_level
from cloudinit.net import activators, dhcp, renderers
from cloudinit.net.netops import NetOps
from cloudinit.net.network_state import parse_net_config_data
@@ -900,10 +901,13 @@ class Distro(persistence.CloudInitPickleMixin, metaclass=abc.ABCMeta):
password_key = "passwd"
# Only "plain_text_passwd" and "hashed_passwd"
# are valid for an existing user.
- LOG.warning(
- "'passwd' in user-data is ignored for existing "
- "user %s",
- name,
+ log_with_downgradable_level(
+ logger=LOG,
+ version="24.3",
+ requested_level=logging.WARNING,
+ msg="'passwd' in user-data is ignored "
+ "for existing user %s",
+ args=name,
)
# As no password specified for the existing user in user-data
@@ -941,20 +945,26 @@ class Distro(persistence.CloudInitPickleMixin, metaclass=abc.ABCMeta):
elif pre_existing_user:
# Pre-existing user with no existing password and none
# explicitly set in user-data.
- LOG.warning(
- "Not unlocking blank password for existing user %s."
+ log_with_downgradable_level(
+ logger=LOG,
+ version="24.3",
+ requested_level=logging.WARNING,
+ msg="Not unlocking blank password for existing user %s."
" 'lock_passwd: false' present in user-data but no existing"
" password set and no 'plain_text_passwd'/'hashed_passwd'"
" provided in user-data",
- name,
+ args=name,
)
else:
# No password (whether blank or otherwise) explicitly set
- LOG.warning(
- "Not unlocking password for user %s. 'lock_passwd: false'"
+ log_with_downgradable_level(
+ logger=LOG,
+ version="24.3",
+ requested_level=logging.WARNING,
+ msg="Not unlocking password for user %s. 'lock_passwd: false'"
" present in user-data but no 'passwd'/'plain_text_passwd'/"
"'hashed_passwd' provided in user-data",
- name,
+ args=name,
)
# Configure doas access
--
2.48.1

View File

@ -0,0 +1,39 @@
From 35baff0028c247e7bf491dbf8e90b303dc7f5388 Mon Sep 17 00:00:00 2001
From: Amy Chen <xiachen@redhat.com>
Date: Thu, 6 Feb 2025 15:52:01 +0800
Subject: [PATCH 2/2] downstream: set deprecation boundary version
RH-Author: xiachen <xiachen@redhat.com>
RH-MergeRequest: 121: Use log_with_downgradable_level for user password warnings (#5927)
RH-Jira: RHEL-71122
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
RH-Commit: [2/2] 9a6858da4c9364eab1e98f34cf3cac011e39e98e (xiachen/cloud-init-centos)
Set features.DEPRECATION_INFO_BOUNDARY to 23.4,
when the cloud-init version set at the callsite of
log_with_downgradable_level() is newer than it,
the log level is downgraded to DEBUG.
X-downstream-only: true
Signed-off-by: Amy Chen <xiachen@redhat.com>
---
cloudinit/features.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cloudinit/features.py b/cloudinit/features.py
index 4f9a59e99..5f8fee62d 100644
--- a/cloudinit/features.py
+++ b/cloudinit/features.py
@@ -87,7 +87,7 @@ On Debian and Ubuntu systems, cc_apt_configure will write a deb822 compatible
to write /etc/apt/sources.list directly.
"""
-DEPRECATION_INFO_BOUNDARY = "devel"
+DEPRECATION_INFO_BOUNDARY = "23.4"
"""
DEPRECATION_INFO_BOUNDARY is used by distros to configure at which upstream
version to start logging deprecations at a level higher than INFO.
--
2.48.1

View File

@ -1,6 +1,6 @@
Name: cloud-init
Version: 24.4
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Cloud instance init scripts
License: ASL 2.0 or GPLv3
URL: http://launchpad.net/cloud-init
@ -15,6 +15,10 @@ Patch4: 0005-downstream-remove-single-process-optimization.patch
Patch5: 0006-fix-don-t-deadlock-when-starting-network-service-wit.patch
# For RHEL-74334 - [rhel-9.6] Suggest to continue using sysconfig as the default network renderer in rhel-9.6
Patch6: ci-downstream-Revert-feat-Use-NetworkManager-renderer-b.patch
# For RHEL-71122 - Suggest to change some log messages from warning to info after rebase cloud-init-24.4 [RHEL-9.6]
Patch7: ci-Use-log_with_downgradable_level-for-user-password-wa.patch
# For RHEL-71122 - Suggest to change some log messages from warning to info after rebase cloud-init-24.4 [RHEL-9.6]
Patch8: ci-downstream-set-deprecation-boundary-version.patch
BuildArch: noarch
@ -229,6 +233,12 @@ fi
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
%changelog
* Mon Feb 10 2025 Jon Maloy <jmaloy@redhat.com> - 24.4-3
- ci-Use-log_with_downgradable_level-for-user-password-wa.patch [RHEL-71122]
- ci-downstream-set-deprecation-boundary-version.patch [RHEL-71122]
- Resolves: RHEL-71122
(Suggest to change some log messages from warning to info after rebase cloud-init-24.4 [RHEL-9.6] )
* Mon Jan 20 2025 Miroslav Rezanina <mrezanin@redhat.com> - 24.4-2
- ci-downstream-Revert-feat-Use-NetworkManager-renderer-b.patch [RHEL-74334]
- Resolves: RHEL-74334