On 10/31/14 10:41, Dan Callaghan wrote:
Ironically, the reason I kept the condition outside the snippet in
the
first place was to avoid breaking existing snippets :-) The previous
version had the template conditional outside the snippets, like this:
{% if distro is osmajor('RedHatEnterpriseLinux6',
'RedHatEnterpriseLinuxGrid6') %}
{% snippet 'readahead_sysconfig' %}
{% endif %}
So if I moved the conditional inside the snippet, then a custom snippet
would suddenly become unconditional (unless the admin also updated their
custom snippet to add the conditional).
Ah...
However I clearly didn't account for the fact that an empty
snippet
would make it a syntax error.
Probably the best solution is to just add a dummy statement after the
"then" statement to make it syntactically valid even if the snippet is
empty. I guess this should work:
if [ -f /etc/sysconfig/readahead ] ; then
:
{% snippet 'readahead_sysconfig' %}
fi
Yeah, it seems the right solution.
Actually I changed my local "readahead_sysconfig" to just contain
":"
to work around the current situation.
--
Jun'ichi Nomura, NEC Corporation