Skip to content

Commit

Permalink
Fixes #36857 - Run content count update on smart proxy after orphan c…
Browse files Browse the repository at this point in the history
…leanup (#10775)
  • Loading branch information
sjha4 authored Oct 27, 2023
1 parent 586f2fe commit f07f474
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions app/lib/actions/katello/orphan_cleanup/remove_orphans.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions app/models/katello/concerns/smart_proxy_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}}
Expand Down

0 comments on commit f07f474

Please sign in to comment.