From bc4d233fa2aade89b43808bb67631f26560e447a 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 | 9 ++++++++- lib/katello/plugin.rb | 6 ++++++ lib/katello/tasks/enable_structured_content_for_deb.rake | 4 +++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/services/katello/pulp3/repository/apt.rb b/app/services/katello/pulp3/repository/apt.rb index e2e723843c7..d8881ae79fd 100644 --- a/app/services/katello/pulp3/repository/apt.rb +++ b/app/services/katello/pulp3/repository/apt.rb @@ -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 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 6a6fd44e04f..9490524607c 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)