Skip to content

Commit

Permalink
Fixes #38056 - Refresh content count action fails when count is set t…
Browse files Browse the repository at this point in the history
…o {}
  • Loading branch information
sjha4 committed Dec 2, 2024
1 parent c06a666 commit f715f04
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/models/katello/concerns/smart_proxy_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,20 @@ def repos_content_count(repos, reset: false)
end

def initialize_content_counts(reset: false)
if reset
if reset || content_counts.empty?
{ content_view_versions: {} }.with_indifferent_access
else
(content_counts&.deep_dup || { content_view_versions: {} }).with_indifferent_access
content_counts.deep_dup.with_indifferent_access
end
end

def process_repository(repo, content_counts)
repo_mirror_service = repo.backend_service(self).with_mirror_adapter
repo_content_counts = repo_mirror_service.latest_content_counts
translated_counts = translate_counts(repo, repo_mirror_service, repo_content_counts)
content_counts[:content_view_versions][repo.content_view_version_id.to_s] ||= { repositories: {}}
if content_counts[:content_view_versions][repo.content_view_version_id.to_s].empty?
content_counts[:content_view_versions][repo.content_view_version_id.to_s] = { repositories: {}}.with_indifferent_access
end
content_counts[:content_view_versions][repo.content_view_version_id.to_s][:repositories][repo.id.to_s] = translated_counts
end

Expand Down

0 comments on commit f715f04

Please sign in to comment.