Skip to content

Commit

Permalink
Fixes #35959 - prepare to use structured publisher for deb content
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernhard committed Apr 19, 2023
1 parent ac0b74a commit 151c89f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/lib/actions/katello/product/content_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion app/lib/actions/katello/repository/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions app/models/katello/root_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,23 @@ 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
params = []
unless deb_components.blank?
params << "comp=#{deb_components.gsub(" ", ",")}"
end
unless deb_releases.blank?
params << "rel=#{deb_releases.gsub(" ", ",")}"
end
unless params.empty?
path += "/?#{params.join('&')}"
end
end
path
end

apipie :class, desc: 'A class representing Repository object' do
name 'Repository'
refs 'Repository'
Expand Down

0 comments on commit 151c89f

Please sign in to comment.