From f46cc5ffdd9697c0014b10d12480e90a47af5145 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 7 Oct 2024 20:30:47 +0200 Subject: [PATCH] Allow removed collection information from previous major releases. --- changelogs/fragments/174-removed-in-previous.yml | 2 ++ src/antsibull_core/collection_meta.py | 4 ++-- tests/functional/test_collection_meta.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/174-removed-in-previous.yml diff --git a/changelogs/fragments/174-removed-in-previous.yml b/changelogs/fragments/174-removed-in-previous.yml new file mode 100644 index 0000000..90cece8 --- /dev/null +++ b/changelogs/fragments/174-removed-in-previous.yml @@ -0,0 +1,2 @@ +minor_changes: + - Allow information on removed collections from previous major releases in collection metadata schema (https://github.com/ansible-community/antsibull-core/pull/174). diff --git a/src/antsibull_core/collection_meta.py b/src/antsibull_core/collection_meta.py index 4dacb81..a74205d 100644 --- a/src/antsibull_core/collection_meta.py +++ b/src/antsibull_core/collection_meta.py @@ -87,10 +87,10 @@ def _validate_collection( def _validate_removal_for_removed( self, collection: str, removal: RemovedRemovalInformation, prefix: str ) -> None: - if removal.version.major != self.major_release: + if removal.version.major > self.major_release: self.errors.append( f"{prefix} version: Major version of removal version {removal.version} must" - f" be current major version {self.major_release}" + f" not be larger than current major version {self.major_release}" ) if ( diff --git a/tests/functional/test_collection_meta.py b/tests/functional/test_collection_meta.py index d3686d3..2914b7b 100644 --- a/tests/functional/test_collection_meta.py +++ b/tests/functional/test_collection_meta.py @@ -185,7 +185,7 @@ "collections: No metadata present for not.there", "removed_collections -> bad.baz1 -> repository: Required field not provided", "removed_collections -> bad.baz2 -> removal -> announce_version: Major version of 9.3.0 must be less than the current major version 9", - "removed_collections -> bad.baz2 -> removal -> version: Major version of removal version 10.2.1 must be current major version 9", + "removed_collections -> bad.baz2 -> removal -> version: Major version of removal version 10.2.1 must not be larger than current major version 9", "removed_collections -> foo.bar: Collection in ansible.in", ], ),