Feature #2310
openTemplate validation
Description
It would be nice if foreman had template validation feature.
How we use foreman:¶
There is a group of people using our foreman instance, mostly for provisioning. We're extensively leveraging hostgroups (which define set of parameters) and provisioning templates, which generate kickstarts based on parameters and it's values. Now we've about 20 hostgroups and 70VMs. We're still extending our hostgroups and develop provisioning templates or snippets.
Problems¶
As we are not ruby developers, we have only little knowledge of templating language within templates. Sometimes, someone updates snippet, and breaks provisioning - template can be rendered for VM in his target hostgroups, but cannot for others, for example because it expects some parameter that is not defined in all hostgroups. That is of course, Mr. 'someone's fault, but right now there's no way to find it out.
Workaround¶
Workaround I wanted to implement was : get all VMs using foreman API, check that it's template returns 200 (using unattened spoof feature)
Solution¶
Foreman could implement template validation itself. I imagine it as a button next to template/snippet editor. After pushing this button, foreman would try to render this template (if editing snippet, it would have to render all templates that include this snippet) for each existing VM.
As a result of breaking a template you would get list of VM templates that were not able to render + render error messages
I know, this solution does not prevent you writing a "bad" template in general, but it is much better nothing.