diff --git a/app/lib/actions/katello/capsule_content/sync_capsule.rb b/app/lib/actions/katello/capsule_content/sync_capsule.rb index eb6f34bf728..b01d0e2d898 100644 --- a/app/lib/actions/katello/capsule_content/sync_capsule.rb +++ b/app/lib/actions/katello/capsule_content/sync_capsule.rb @@ -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 diff --git a/lib/katello/plugin.rb b/lib/katello/plugin.rb index ce4e56bba7d..5d07c6fc940 100644 --- a/lib/katello/plugin.rb +++ b/lib/katello/plugin.rb @@ -657,6 +657,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//content_views//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