Project

General

Profile

Feature #2310

Template validation

Added by Libor Zoubek almost 10 years ago. Updated almost 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Templates
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

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.


Related issues

Related to Foreman - Feature #3873: Validate syntax of kickstart and preseed scriptsNew2013-12-13

Associated revisions

Revision 2b5eeea6 (diff)
Added by Derek Tamsen about 6 years ago

Refs #2310,#3873 - test preseed configs

closes GH-332
closes GH-333

History

#1 Updated by Ivan Necas almost 10 years ago

Makes ton of sense to me to perform this validation, at least on demand and/or on subset of input params or with some defaults.

#2 Updated by Dominic Cleal about 9 years ago

  • Related to Feature #3873: Validate syntax of kickstart and preseed scripts added

Also available in: Atom PDF