Repository navigation
Conversation
Setting::TemplateSync went away when Foreman moved settings into the settings registry, so foreman-rake templates:cleanup has been failing every time with: NameError: uninitialized constant Setting::TemplateSync Delete the stored template_sync_* settings directly. Also remove the plugin's permissions and the default role filters that held them; otherwise import_templates, export_templates and view_template_syncs stay in the database after the plugin is uninstalled.
dkelson
force-pushed
the
fix-templates-cleanup
branch
from
October 9, 2026 22:06
b8fc03c to
b73b68c
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
foreman-rake templates:cleanupfails on current Foreman:Setting::TemplateSyncno longer exists now that settings live in the registry. The cleaner now deletes any storedtemplate_sync_*rows directly.While testing I also found the plugin's permissions survive an uninstall.
add_all_permissions_to_default_rolesputsimport_templates,export_templatesandview_template_syncsinto Manager, Organization admin and Viewer, and they are still there after the cleanup anddnf remove. The cleaner now takes those permissions out of their filters, drops any filter left empty and deletes the permissions.Tested on Foreman 3.18 / Katello 4.20 (EL9) with foreman_templates 11.0.1: enable the plugin with the installer, disable it, run
foreman-rake templates:cleanup, remove the packages and restart. Before this change the rake task aborts and the three permissions remain. With it the task finishes, the permissions and their filters are gone, andhammer pingis clean.