diff --git a/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb b/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb index 5db8ae44699..4897ba2d832 100644 --- a/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +++ b/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb @@ -15,9 +15,17 @@ def plan(proxy) plan_action( Actions::Pulp3::Orchestration::OrphanCleanup::RemoveOrphans, proxy) + plan_self(:smart_proxy_id => proxy.id) end end end + + def finalize + smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id]) + if smart_proxy.pulp_mirror? + ::ForemanTasks.async_task(::Actions::Katello::CapsuleContent::UpdateContentCounts, smart_proxy) + end + end end end end diff --git a/app/models/katello/concerns/smart_proxy_extensions.rb b/app/models/katello/concerns/smart_proxy_extensions.rb index c6c2e218f8e..54852441371 100644 --- a/app/models/katello/concerns/smart_proxy_extensions.rb +++ b/app/models/katello/concerns/smart_proxy_extensions.rb @@ -126,9 +126,8 @@ def update_content_counts! new_content_counts = { content_view_versions: {} } smart_proxy_helper = ::Katello::SmartProxyHelper.new(self) repos = smart_proxy_helper.repositories_available_to_capsule - return new_content_counts if repos.empty? - repos.each do |repo| + repos&.each do |repo| repo_mirror_service = repo.backend_service(self).with_mirror_adapter repo_content_counts = repo_mirror_service.latest_content_counts translated_counts = {metadata: {}, counts: {}}