From 2a4a2683206f552aec88860decbadfd3910ff613 Mon Sep 17 00:00:00 2001 From: Bernhard Suttner Date: Tue, 17 Jan 2023 09:54:17 +0100 Subject: [PATCH] Fixes #35959 - prepare to use structured publisher for deb content --- .../actions/katello/product/content_create.rb | 4 ++-- app/lib/actions/katello/repository/update.rb | 2 +- app/models/katello/root_repository.rb | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/lib/actions/katello/product/content_create.rb b/app/lib/actions/katello/product/content_create.rb index db1866ef253..b0e4f994427 100644 --- a/app/lib/actions/katello/product/content_create.rb +++ b/app/lib/actions/katello/product/content_create.rb @@ -14,7 +14,7 @@ def plan(root) arches: root.format_arches, label: root.custom_content_label, os_versions: root.os_versions&.join(','), - content_url: root.custom_content_path) + content_url: root.format_custom_content_path) content_id = content_create.output[:response][:id] plan_action(Candlepin::Product::ContentAdd, owner: root.product.organization.label, product_id: root.product.cp_id, @@ -32,7 +32,7 @@ def plan(root) type: root.content_type, arches: root.format_arches, label: root.custom_content_label, - content_url: root.custom_content_path, + content_url: root.format_custom_content_path, gpg_key_url: root.library_instance.yum_gpg_key_url) end diff --git a/app/lib/actions/katello/repository/update.rb b/app/lib/actions/katello/repository/update.rb index f0d1dbdcfb9..b22e24939c9 100644 --- a/app/lib/actions/katello/repository/update.rb +++ b/app/lib/actions/katello/repository/update.rb @@ -26,7 +26,7 @@ def plan(root, repo_params) :owner => repository.organization.label, :content_id => root.content_id, :name => root.name, - :content_url => root.custom_content_path, + :content_url => root.format_custom_content_path, :gpg_key_url => repository.yum_gpg_key_url, :label => content.label, :type => root.content_type, diff --git a/app/models/katello/root_repository.rb b/app/models/katello/root_repository.rb index 67c63b21c64..30346afccc3 100644 --- a/app/models/katello/root_repository.rb +++ b/app/models/katello/root_repository.rb @@ -434,6 +434,24 @@ def format_arches end end + def format_custom_content_path + path = custom_content_path + if content_type == ::Katello::Repository::DEB_TYPE && SETTINGS[:katello][:use_deb_structured_publisher] == true + first = true + + unless deb_components.blank? + path += "/?comp=#{deb_components.gsub(" ", ",")}" + first = false + end + + unless deb_releases.blank? + path += first ? "/?" : "&" + path += "rel=#{deb_releases.gsub(" ", ",")}" + end + end + path + end + apipie :class, desc: 'A class representing Repository object' do name 'Repository' refs 'Repository'