app/services/katello/pulp3/repository/yum.rb in katello-4.2.0.1 vs app/services/katello/pulp3/repository/yum.rb in katello-4.2.1
- old
+ new
@@ -9,28 +9,22 @@
include Katello::Util::PulpcoreContentFilters
UNIT_LIMIT = 10_000
def remote_options
- url, sles_token = extract_sles_token
options = common_remote_options
- options.merge!(sles_auth_token: sles_token) if sles_token
- options.merge!(url: url, policy: root.download_policy)
+ uri = URI(root.url)
+ unless root.upstream_authentication_token.blank?
+ options.merge!(sles_auth_token: root.upstream_authentication_token)
+ end
+ options.merge!(url: uri.to_s, policy: root.download_policy)
end
def specific_create_options
{ retain_package_versions: retain_package_versions_count }
end
- def extract_sles_token
- return [nil, nil] if root.url.blank?
- uri = URI(root.url)
- query = uri.query
- uri.query = nil
- [uri.to_s, query]
- end
-
def skip_types
skip_types = []
if root.ignorable_content.try(:include?, "srpm")
skip_types << "srpm"
end
@@ -301,18 +295,19 @@
whitelist_ids = filter_list_map[:whitelist_ids].flatten&.uniq
blacklist_ids = filter_list_map[:blacklist_ids].flatten&.uniq
content_unit_hrefs = whitelist_ids - blacklist_ids
+ source_repo_ids.each do |source_repo_id|
+ content_unit_hrefs += ::Katello::Repository.find(source_repo_id).srpms.pluck(:pulp_id)
+ end
+
if content_unit_hrefs.any?
source_repo_ids.each do |source_repo_id|
content_unit_hrefs += additional_content_hrefs(::Katello::Repository.find(source_repo_id), content_unit_hrefs)
end
end
- source_repo_ids.each do |source_repo_id|
- content_unit_hrefs += ::Katello::Repository.find(source_repo_id).srpms.pluck(:pulp_id)
- end
dest_repo_map[:content_unit_hrefs] = content_unit_hrefs.uniq.sort
end
dependency_solving = options[:solve_dependencies] || false
@@ -346,14 +341,14 @@
whitelist_ids += source_repository.module_streams.pluck(:pulp_id).sort
end
whitelist_ids += modular_packages(source_repository, inclusion_modular_filters) unless inclusion_modular_filters.empty?
blacklist_ids += modular_packages(source_repository, exclusion_modular_filters) unless exclusion_modular_filters.empty?
content_unit_hrefs = whitelist_ids - blacklist_ids
+ content_unit_hrefs += source_repository.srpms.pluck(:pulp_id)
if content_unit_hrefs.any?
content_unit_hrefs += additional_content_hrefs(source_repository, content_unit_hrefs)
end
- content_unit_hrefs += source_repository.srpms.pluck(:pulp_id)
copy_units(source_repository, content_unit_hrefs.uniq, options[:remove_all])
end
def modular_packages(source_repository, filters)
list_ids = []
@@ -366,21 +361,25 @@
def additional_content_hrefs(source_repository, content_unit_hrefs)
repo_service = source_repository.backend_service(SmartProxy.pulp_primary)
options = { :repository_version => source_repository.version_href }
errata_to_include = filter_errata_by_pulp_href(source_repository.errata, content_unit_hrefs,
- source_repository.rpms.pluck(:filename))
- content_unit_hrefs += errata_to_include.collect { |erratum| erratum.repository_errata.pluck(:erratum_pulp3_href) }.flatten
+ source_repository.rpms.pluck(:filename) +
+ source_repository.srpms.pluck(:filename))
+ content_unit_hrefs += errata_to_include.collect do |erratum|
+ erratum.repository_errata.where(repository_id: source_repository.id).pluck(:erratum_pulp3_href)
+ end
+ content_unit_hrefs.flatten!
package_groups_to_include = filter_package_groups_by_pulp_href(source_repository.package_groups, content_unit_hrefs)
content_unit_hrefs += package_groups_to_include.pluck(:pulp_id)
metadata_file_hrefs_to_include = filter_metadatafiles_by_pulp_hrefs(
- repo_service.metadatafiles(options).results, content_unit_hrefs)
+ repo_service.metadatafiles(options)&.results, content_unit_hrefs)
content_unit_hrefs += metadata_file_hrefs_to_include
distribution_tree_hrefs_to_include = filter_distribution_trees_by_pulp_hrefs(
- repo_service.distributiontrees(options).results, content_unit_hrefs)
+ repo_service.distributiontrees(options)&.results, content_unit_hrefs)
content_unit_hrefs + distribution_tree_hrefs_to_include
end
end
end
end