From a81457364f2c1c8b90f6ab96b70d95ec6ec349ed Mon Sep 17 00:00:00 2001 From: James Falcon Date: Fri, 28 Jun 2024 15:55:23 -0500 Subject: [PATCH 1/2] fix: dont double-log deprecated INFOs (#5465) --- cloudinit/util.py | 1 - tests/unittests/test_log.py | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cloudinit/util.py b/cloudinit/util.py index f42e641440b..8cac7dc8b2d 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -3255,7 +3255,6 @@ def deprecate( "devel" != features.DEPRECATION_INFO_BOUNDARY and Version.from_str(features.DEPRECATION_INFO_BOUNDARY) < version ): - LOG.info(deprecate_msg) level = logging.INFO elif hasattr(LOG, "deprecated"): level = log.DEPRECATED diff --git a/tests/unittests/test_log.py b/tests/unittests/test_log.py index e68dcc48029..78b53f5a9f9 100644 --- a/tests/unittests/test_log.py +++ b/tests/unittests/test_log.py @@ -84,7 +84,12 @@ def test_deprecated_log_level(self, caplog): ), ) def test_deprecate_log_level_based_on_features( - self, expected_log_level, deprecation_info_boundary, caplog, mocker + self, + expected_log_level, + deprecation_info_boundary, + caplog, + mocker, + clear_deprecation_log, ): """Deprecation log level depends on key deprecation_version From 9c13b650dd1b99192dfd4dabc258989da555c9ff Mon Sep 17 00:00:00 2001 From: James Falcon Date: Fri, 28 Jun 2024 16:02:05 -0500 Subject: [PATCH 2/2] chore: fix schema.py formatting (#5465) --- cloudinit/config/schema.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cloudinit/config/schema.py b/cloudinit/config/schema.py index 292c1efe664..c7c23731aac 100644 --- a/cloudinit/config/schema.py +++ b/cloudinit/config/schema.py @@ -795,11 +795,10 @@ def validate_cloudconfig_schema( if isinstance( schema_error, SchemaDeprecationError ): # pylint: disable=W1116 - if ( - "devel" != features.DEPRECATION_INFO_BOUNDARY - and (schema_error.version == "devel" + if "devel" != features.DEPRECATION_INFO_BOUNDARY and ( + schema_error.version == "devel" or Version.from_str(schema_error.version) - > Version.from_str(features.DEPRECATION_INFO_BOUNDARY)) + > Version.from_str(features.DEPRECATION_INFO_BOUNDARY) ): info_deprecations.append( SchemaProblem(path, schema_error.message)