From 1cbaafc110da743162d4a528dd9c24a63d9035ce Mon Sep 17 00:00:00 2001 From: Markus Bucher Date: Thu, 25 Jan 2024 12:34:46 +0100 Subject: [PATCH] fixup! [PR] Fixes #35959 - Add structured APT content mode --- app/models/katello/root_repository.rb | 2 +- app/services/katello/pulp3/repository/apt.rb | 5 ----- .../tasks/enable_structured_content_for_deb.rake | 12 ++++++------ 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/models/katello/root_repository.rb b/app/models/katello/root_repository.rb index 087bf33d676..c70be50bc2f 100644 --- a/app/models/katello/root_repository.rb +++ b/app/models/katello/root_repository.rb @@ -457,7 +457,7 @@ def format_custom_content_path path += "?#{params.join('&')}" else Rails.logger.warn("deb_use_structured_content is set, but repository #{self.name} is lacking deb_releases or deb_components, so we are defaulting to using simple content.") - if not Setting['deb_use_simple_publish'] + unless Setting['deb_use_simple_publish'] Rails.logger.warn("Defaulting to using simple content for repository #{self.name}, but deb_use_simple_publish is not set! This can lead to errors on the clients!") end end diff --git a/app/services/katello/pulp3/repository/apt.rb b/app/services/katello/pulp3/repository/apt.rb index c1cac215ebd..f96fb65129b 100644 --- a/app/services/katello/pulp3/repository/apt.rb +++ b/app/services/katello/pulp3/repository/apt.rb @@ -31,11 +31,6 @@ def sync_url_params(sync_options) end def mirror_remote_options - policy = smart_proxy.download_policy - if smart_proxy.download_policy == SmartProxy::DOWNLOAD_INHERIT - policy = repo.root.download_policy - end - if Setting['deb_use_structured_proxy_sync'] distributions = "#{repo.deb_releases}" elsif Setting['deb_use_simple_publish'] diff --git a/lib/katello/tasks/enable_structured_content_for_deb.rake b/lib/katello/tasks/enable_structured_content_for_deb.rake index 9490524607c..6bc11fdb5c3 100644 --- a/lib/katello/tasks/enable_structured_content_for_deb.rake +++ b/lib/katello/tasks/enable_structured_content_for_deb.rake @@ -1,12 +1,12 @@ namespace :katello do desc "Enable or disable the use of structured content for APT clients." - task :enable_structured_content_for_deb, ['deb_use_structured_content'] => ['environment', 'dynflow:client', "check_ping"] do |t, args| + task :enable_structured_content_for_deb, ['deb_use_structured_content'] => ['environment', 'dynflow:client', 'check_ping'] do |_t, args| unless ['true', 'false'].include?(args[:deb_use_structured_content]) - puts "You must specify if structured content should be enabled or disabled, your options are:" - puts " foreman-rake katello:enable_structured_content_for_deb[true]" - puts " foreman-rake katello:enable_structured_content_for_deb[false]" + puts 'You must specify if structured content should be enabled or disabled, your options are:' + 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!" + puts 'Note that after enabling structured content, you may need to resync your proxies!' exit 1 end @@ -25,7 +25,7 @@ namespace :katello do roots.each do |root| # Note that we are assuming root.deb_releases must necessarily be set already if url is also set. components = root.deb_components - if components.blank? and deb_use_structured_content + if components.blank? && deb_use_structured_content repo = root.library_instance repo_backend_service = repo.backend_service(SmartProxy.pulp_primary) pulp_components = repo_backend_service.api.content_release_components_api.list(repository_version: repo.version_href)