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 #37356 - Allow turning automatic content count updates off #11014

Merged
merged 1 commit into from
Jun 18, 2024
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
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
Loading