Commit 98f93fcc by Jeroen Hoekx

Preserve trailing newline after templating.

Jinja seems to eat trailing whitespace. A lot of tools complain about this: iptables-restore, iscsid...
parent ee34c0c1
......@@ -241,7 +241,10 @@ def template(text, vars, setup_cache, no_engine=False):
return text
else:
template = jinja2.Template(text)
return template.render(vars)
res = template.render(vars)
if text.endswith('\n') and not res.endswith('\n'):
res = res + '\n'
return res
def double_template(text, vars, setup_cache):
return template(template(text, vars, setup_cache), vars, setup_cache)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment