From d9c75c3cde6ac4624b83b922f56bc2301c053b6c Mon Sep 17 00:00:00 2001 From: Markus Bucher Date: Wed, 25 Oct 2023 10:52:17 +0200 Subject: [PATCH] Fixes #36859 - Fix inconsistent repo publication --- app/lib/actions/pulp3/repository/save_version.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/lib/actions/pulp3/repository/save_version.rb b/app/lib/actions/pulp3/repository/save_version.rb index ff3b332faac..b2c59a0cc8e 100644 --- a/app/lib/actions/pulp3/repository/save_version.rb +++ b/app/lib/actions/pulp3/repository/save_version.rb @@ -34,7 +34,12 @@ def run repo.update(:version_href => version_href) end else - output[:contents_changed] = false + # get publication and check if repo-version and publication match. Otherwise, contents_changed: false + if fetch_current_published_version_href(repo) != repo.version_href + output[:contents_changed] = true + else + output[:contents_changed] = false + end end end @@ -44,6 +49,12 @@ def fetch_version_href(repo) repo_href = repo_backend_service.repository_reference.repository_href repo_backend_service.api.repositories_api.read(repo_href).latest_version_href end + + def fetch_current_published_version_href(repo) + # Fetch latest Pulp 3 repo version + repo_backend_service = repo.backend_service(SmartProxy.pulp_primary) + repo_backend_service.api.publications_api.read(repo.publication_href).repository_version + end end end end