app/lib/actions/katello/capsule_content/sync.rb in katello-3.2.0 vs app/lib/actions/katello/capsule_content/sync.rb in katello-3.2.1
- old
+ new
@@ -18,11 +18,11 @@
repository = options.fetch(:repository, nil)
content_view = options.fetch(:content_view, nil)
fail _("Action not allowed for the default capsule.") if capsule_content.default_capsule?
- need_updates = repos_needing_updates(capsule_content, environment, content_view)
+ need_updates = repos_needing_updates(capsule_content, environment, content_view, repository)
repository_ids = get_repository_ids(capsule_content, environment, content_view, repository)
unless repository_ids.blank?
sequence do
need_updates.each do |repo|
plan_action(Pulp::Repository::Refresh, repo, capsule_id: capsule_content.capsule.id)
@@ -71,11 +71,15 @@
end
repository_ids
end
- def repos_needing_updates(capsule_content, environment, content_view)
- repos = capsule_content.repos_available_to_capsule(environment, content_view)
+ def repos_needing_updates(capsule_content, environment, content_view, repository)
+ repos = if repository
+ [repository]
+ else
+ capsule_content.repos_available_to_capsule(environment, content_view)
+ end
need_importer_update = ::Katello::Repository.needs_importer_updates(repos, capsule_content)
need_distributor_update = ::Katello::Repository.needs_distributor_updates(repos, capsule_content)
(need_distributor_update + need_importer_update).uniq
end