Download Template and Jinja

For some reason, Jinja claims that he cannot find the pattern that I specified in his 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

He definitely lives there, though. What's happening?

+5
source share
3 answers

To clarify the settlers' answer, this will be your example with the correct 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)
+5
source

From the upload_template docstring file:

, use_jinja True, Jinja2      , Jinja     .      , template_dir, .

.

+2

In fact, this may be a mistake.

Check out: https://github.com/fabric/fabric/issues/621

0
source

All Articles