-
Notifications
You must be signed in to change notification settings - Fork 107
Remove note about cloning and editing templates #4296
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
base: master
Are you sure you want to change the base?
Conversation
I'm not sure if job templates support custom snippets the same way as provisioning templates. That would require further research. |
Lennonka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change LGTM, but I would appreciate a tech ack.
288b4bf to
7fe05f7
Compare
Users should never clone and edit templates. Instead, if they really need to run custom code before or after registration or provisioning workflows, they should use "custom pre" and "custom post" snippets as documented. This way they do not lose support by the community/vendor. Also, there's configuration management. Fixes theforeman#4256
7fe05f7 to
5ffa48f
Compare
|
Rebased to HEAD of "master" and resolved all merge conflicts. @stejskalleos Can you please review my PR? Does it make sense to you from a technical perspective? |
| If you require modification to an original template, clone the template, edit the clone, and associate the clone instead of the original template. | ||
| For more information, see xref:running-custom-code-during-host-provisioning-by-using-web-ui[]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should recommend users to not clone provisioning template, since those are locked by default and how users would add pre/post snippets to it without cloning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to not clone and edit at all. Instead, users can write "custom pre" and "custom post" snippets that are automatically picked up by supported templates. Example in foreman on "develop":
app/views/unattended/provisioning_templates/provision/kickstart_default.erb
222:<%= snippet_if_exists(template_name + " custom pre") %>
So locked template pick up user-provided snippets if present, which avoids the whole "clone+edit and lose updates/support" kinda situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Max is saying, the custom pre/post snippets do not have to be added to templates because the code is there by default (example). If the snippets don't exist, nothing happens. Once the user creates them, the templates pick them up automatically.
Therefore, the user doesn't have to clone and edit templates to add the snippets to the provisioning process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stejskalleos Can you please ack this ^^ and this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the snippets don't exist, nothing happens. Once the user creates them, the templates pick them up automatically.
Correct.
Therefore, the user doesn't have to clone and edit templates to add the snippets to the provisioning process.
Also correct.
| ==== | ||
| You can use the original templates shipped in {Project} as described below. | ||
| If you require modification to an original template, clone the template, edit the clone, and associate the clone instead of the original template. | ||
| For more information, see xref:running-custom-code-during-host-provisioning-by-using-web-ui[]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this isn't a correct link for the clone guide, which should be either https://docs.theforeman.org/nightly/Provisioning_Hosts/index-katello.html#cloning-provisioning-templates, right?
cc @stejskalleos @ShimShtein
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this relevant when we're removing it?
What changes are you introducing?
Users should never clone and edit templates. Instead, if they really need to run custom code before or after registration or provisioning workflows, they should use "custom pre" and "custom post" snippets as documented. This way they do not lose support by the community/vendor.
Also, there's configuration management.
Why are you introducing these changes? (Explanation, links to references, issues, etc.)
Fixes #4256
Anything else to add? (Considerations, potential downsides, alternative solutions you have explored, etc.)
Should we also drop the hint about cloning and editing in
guides/common/modules/proc_setting-up-job-templates.adoc?Contributor checklists
Please cherry-pick my commits into: