Skip to content

Commit

Permalink
Fixes #37356 - Allow turning automatic content count updates off
Browse files Browse the repository at this point in the history
  • Loading branch information
sjha4 committed Jun 4, 2024
1 parent 388d17d commit 7854239
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/lib/actions/katello/capsule_content/sync_capsule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ def repos_to_sync(smart_proxy, environment, content_view, repository, skip_metat
end

def update_content_counts(_execution_plan)
smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id])
::ForemanTasks.async_task(::Actions::Katello::CapsuleContent::UpdateContentCounts, smart_proxy)
if Setting[:automatic_content_count_updates]
smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id])
::ForemanTasks.async_task(::Actions::Katello::CapsuleContent::UpdateContentCounts, smart_proxy)
else
Rails.logger.info "Skipping content counts update as automatic content count updates are disabled. To enable automatic content count updates, set the 'automatic_content_count_updates' setting to true.
To update content counts manually, run the 'Update Content Counts' action."
end
end

def resource_locks
Expand Down
6 changes: 6 additions & 0 deletions lib/katello/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,12 @@ def katello_template_setting_values(name)
default: true,
full_name: N_('Distribute archived content view versions'),
description: N_("If this is enabled, repositories of content view versions without environments (\"archived\") will be distributed at '/pulp/content/<organization>/content_views/<content view>/X.Y/...'.")

setting 'automatic_content_count_updates',
type: :boolean,
default: true,
full_name: N_('Calculate content counts on smart proxies automatically'),
description: N_("If this is enabled, content counts on smart proxies will be updated automatically after content sync.")
end
end

Expand Down

0 comments on commit 7854239

Please sign in to comment.