Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #36857 - Run content count update on smart proxy after orphan cleanup #10775

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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