Skip to content

Commit

Permalink
[DEBSTRUCTURED] Add deb_use_structured_proxy_sync setting
Browse files Browse the repository at this point in the history
Should be added to:

[PR] Fixes #35959 - Add structured APT content mode
  • Loading branch information
quba42 committed Dec 13, 2023
1 parent 77f22fc commit bc4d233
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion app/services/katello/pulp3/repository/apt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ def mirror_remote_options
policy = repo.root.download_policy
end

distributions = "#{repo.deb_releases}"
if Setting['deb_use_structured_proxy_sync']
distributions = "#{repo.deb_releases}"
elsif Setting['deb_use_simple_publish']
distributions = 'default'
else
fail("It cannot work to set both deb_use_structured_proxy_sync and deb_use_simple_publish to False! Please set at least one of them to True!")
end

if Setting['deb_use_simple_publish'] and not distributions.split(' ').include? 'default'
distributions.concat(' default')
end
Expand Down
6 changes: 6 additions & 0 deletions lib/katello/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,12 @@ def katello_template_setting_values(name)
default: false,
full_name: N_('Use structured content for deb clients'),
description: N_("If enabled, repo URL's for deb content hosts will be appended with structure information where available.")

setting 'deb_use_structured_proxy_sync',
type: :boolean,
default: false,
full_name: N_('Sync structured content for proxy syncs'),
description: N_("If enabled, any upstream distributions synced to the server will also be used for proxy syncs.")
end
end

Expand Down
4 changes: 3 additions & 1 deletion lib/katello/tasks/enable_structured_content_for_deb.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace :katello do
puts " foreman-rake katello:enable_structured_content_for_deb[true]"
puts " foreman-rake katello:enable_structured_content_for_deb[false]"
puts "Note that use of structured content is currently set to '#{Setting['deb_use_structured_content']}'!"
puts "Note that after enabling structured content, you may need to resync your proxies!"
exit 1
end

Expand All @@ -15,8 +16,9 @@ namespace :katello do
# Force deb_use_simple_publish to true, since we are not yet ready to drop simple publishing!
Setting['deb_use_simple_publish'] = true

# Update deb_use_structured_content to the value requested by the user:
# Update deb_use_structured_content and deb_sue_structured_proxy_sync to the value requested by the user:
Setting['deb_use_structured_content'] = deb_use_structured_content
Setting['deb_use_structured_proxy_sync'] = deb_use_structured_content

# Ignore repositories where url is not set, since those are presumably empty or used for uploads!
roots = Katello::RootRepository.deb_type.where.not(url: nil)
Expand Down

0 comments on commit bc4d233

Please sign in to comment.