From bb78271d86ccb9dc1a40304042006e10cc5c0ddd Mon Sep 17 00:00:00 2001 From: Quirin Pamp Date: Mon, 16 Oct 2023 16:17:36 +0200 Subject: [PATCH] [DEBSTRUCTURED] Add deb_use_structured_proxy_sync setting Should be added to: [PR] Fixes #35959 - Add structured APT content mode --- app/services/katello/pulp3/repository/apt.rb | 4 ++++ lib/katello/plugin.rb | 6 ++++++ lib/katello/tasks/enable_structured_content_for_deb.rake | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/services/katello/pulp3/repository/apt.rb b/app/services/katello/pulp3/repository/apt.rb index e2a97c97f5a..69cb14e537c 100644 --- a/app/services/katello/pulp3/repository/apt.rb +++ b/app/services/katello/pulp3/repository/apt.rb @@ -39,6 +39,10 @@ def mirror_remote_options 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 + super.merge({distributions: distributions}) end diff --git a/lib/katello/plugin.rb b/lib/katello/plugin.rb index 6b75dfe9e55..a5b3da7f496 100644 --- a/lib/katello/plugin.rb +++ b/lib/katello/plugin.rb @@ -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 diff --git a/lib/katello/tasks/enable_structured_content_for_deb.rake b/lib/katello/tasks/enable_structured_content_for_deb.rake index e3cf29dae02..6bc11fdb5c3 100644 --- a/lib/katello/tasks/enable_structured_content_for_deb.rake +++ b/lib/katello/tasks/enable_structured_content_for_deb.rake @@ -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 @@ -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)