Hi guys,
as pointed out at
http://gerrit.beaker-project.org/#/c/3891/ I've been
considering some improvements to the way workflow-installer-test processes its
templates.
Currently all kickstart templates have things like
{% if OS_MAJOR > 5 %}%end{% endif %}
or
{% if OS_MAJOR == 5 %}
key --skip
{% endif %}
which is relevant only for RHEL distros and not for Fedora. On top of that
Rawhide snapshots are imported as FAMILY=Fedora, MAJOR=rawhide, MINOR=0.
I suggest the following improvements in order to provide richer context and
minimize template bloat and rewriting:
1) Provide a {% end FAMILY OS_MAJOR %} tag which will insert the closing %end
(for %packages or %pre/%post) if needed. This will be implemented as a Jinja
extension.
2) Provide filters like isRHEL, isFedora, isRawhide to help with template
writing. These will be implemented as Jinja filters. Currently I even have a
filter which supports a somewhat cryptic syntax:
FAMILY|isRHEL - returns bool
OS_MAJOR|isRHEL(FAMILY) > 5 - returns either OS_MAJOR if FAMILY is RHEL or 0 if
FAMILY is something else.
Additionally Dan Callaghan commented on Gerrit:
Yes it sounds like this is a good time to re-think the template vars for
workflow-installer-test. It would be really good to have them more consistent with the
server side templates.
I don't know how server side templates look like so Dan please comment how can
we make both sides more consistent ?
Additionally (see Gerrit) OS_MINOR can be either a digit (0, 1, 2, etc) or a
string (Alpha, Beta, etc). My patch above changed the type of OS_MINOR, OS_MAJOR
to string and so far things work but I suspect there will be issues with
comparisons like 2 > 20 (different number of digits). Currently OS_MINOR doesn't
seem to be used anywhere in the templates.
Any other comments or ideas are welcome as well.
Thanks,
Alex