Hello foreman-devs, recently I was told about the bug that we override all templates in database whenever we run db:seed. From the code [1] and commit message [2], it was not the intended behavior. It was supposed to check whether user made some changes and only apply the new version if the template was not touched. Sadly, the method only checks the name attribute for changes [3], so if "only" template content was changed, we still override it.
While I can try to fix it to originally intended behavior, I'd like to ask whether it wouldn't be better to use this opportunity and start locking templates we ship by default. The recommended workflow for users would be to clone the template if custom changes are needed. We'd always update locked templates. Obviously, user would need to merge new version to cloned template on his own. With foreman_templates plugin it should be easy enough to export templates and see the diff between default and customized template, apply the changes user wants and then reimport them back. I think this would be overall better user experience and safer workflow. The originally intended behavior would never update a template that user modified. That means after update user ends up with template from old Foreman version (with custom changes) that might not be compatible with the new Foreman version. This is more likely to happen than before because we now version templates in community-repo and we don't keep backward compatibility as we did before. Thanks for reading, thoughts? [1] https://github.com/theforeman/foreman/blob/1.14.0/db/seeds.d/07-provisioning_templates.rb#L98 [2] https://github.com/theforeman/foreman/commit/ d4ed70154fa9f6c83597adc784240e3865845563 [3] https://github.com/theforeman/foreman/blob/1.14-stable/db/seeds.rb#L33 -- Marek -- You received this message because you are subscribed to the Google Groups "foreman-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
