出于某种原因,Jinja声称它无法找到我在Fabric任务中指定的模板:
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)
但每次我跑,我都会
jinja2.exceptions.TemplateNotFound: /path/to/dir/conf/httpd.conf
它肯定住在那里.这是怎么回事?
为了澄清oselivanov的答案,这将是你的正确格式的例子:
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)