For some reason, Jinja claims that it is unable to find a template that I have specified in my Fabric task:
httpd_local = "/path/to/dir/conf/" # with httpd.conf located here
httpd_remote = "/etc/httpd/conf/httpd.conf"
with lcd(httpd_local):
upload_template(filename='/path/to/dir/conf/httpd.conf', destination=httpd_remote, context=context[hostname], use_jinja=True)
But every time I run, I get
jinja2.exceptions.TemplateNotFound: /path/to/dir/conf/httpd.conf
It definitely lives there though. What's going on?
To clarify oselivanov's answer, this would be your example with the proper format:
httpd_local = "/path/to/dir/conf/" # with httpd.conf located here
httpd_remote = "/etc/httpd/conf/httpd.conf"
with lcd(httpd_local):
upload_template(filename='httpd.conf', destination=httpd_remote, template_dir='/path/to/dir/conf', context=context[hostname], use_jinja=True)
From upload_template docstring:
Alternately, if
use_jinja
is set to True and you have the Jinja2 templating library available, Jinja will be used to render the template instead. Templates will be loaded from the invoking user's current working directory by default, or fromtemplate_dir
if given.
Сonfusing behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With