app/services/katello/pulp3/repository/apt.rb in katello-4.14.1 vs app/services/katello/pulp3/repository/apt.rb in katello-4.15.0.rc1

- old
+ new

@@ -5,14 +5,22 @@ class Repository class Apt < ::Katello::Pulp3::Repository UNIT_LIMIT = 10_000 SIGNING_SERVICE_NAME = 'katello_deb_sign'.freeze + def initialize_empty + # For every empty APT library instance repository we must add at least a release component to + # ensure we have a publishable repo with consumable metadata. Otherwise smart proxy syncs will + # fail, and consuming hosts will choke on empty repos. + opts = {:repository => repository_reference.repository_href, :component => "empty", :distribution => "katello"} + api.content_release_components_api.create(opts) + end + def remote_options deb_remote_options = { policy: root.download_policy, - distributions: root.deb_releases + distributions: root.deb_releases, } deb_remote_options[:components] = root.deb_components.present? ? root.deb_components : nil deb_remote_options[:architectures] = root.deb_architectures.present? ? root.deb_architectures : nil if root.url.blank? @@ -29,35 +37,33 @@ params[:optimize] = sync_options[:optimize] if sync_options.key?(:optimize) params end def mirror_remote_options - super.merge( - { - distributions: repo.deb_releases + "#{' default' unless repo.deb_releases.include? 'default'}" - } - ) + distributions = if repo.deb_using_structured_apt? + repo.deb_pulp_distributions.join(' ') + else + 'default' + end + + super.merge({distributions: distributions}) end - def publication_options(repository_version) + def publication_options(repository) ss = api.signing_services_api.list(name: SIGNING_SERVICE_NAME).results - popts = super(repository_version) - popts.merge!( - { - structured: true, # publish real suites (e.g. 'stable') - simple: true # publish all into 'default'-suite - } - ) + popts = super(repository) + popts.merge!({ structured: true }) + popts.merge!({ simple: true }) unless repository.deb_using_structured_apt? popts[:signing_service] = ss[0].pulp_href if ss && ss.length == 1 popts end def distribution_options(path) { base_path: path, publication: repo.publication_href, - name: "#{generate_backend_object_name}" + name: "#{generate_backend_object_name}", } end def partial_repo_path "/pulp/deb/#{repo.relative_path}/".sub('//', '/') @@ -102,10 +108,10 @@ data_dup.config = [] data.config.each do |repo_config| config_hash = { source_repo_version: repo_config[:source_repo_version], dest_repo: repo_config[:dest_repo], - content: [] + content: [], } config_hash[:dest_base_version] = repo_config[:dest_base_version] if repo_config[:dest_base_version] data_dup.config << config_hash end data_dup