From 3d4f099f52e496ddf72e69c8eabd8206f241e93c Mon Sep 17 00:00:00 2001 From: Samir Jha Date: Tue, 4 Jun 2024 17:33:40 +0000 Subject: [PATCH] Fixes #37356 - Allow turning automatic content count updates off --- app/lib/actions/katello/capsule_content/sync_capsule.rb | 9 +++++++-- lib/katello/plugin.rb | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) 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 d658224e87c..38879fd5f28 100644 --- a/lib/katello/plugin.rb +++ b/lib/katello/plugin.rb @@ -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//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