2011-08-03 65 views
5

出於某種原因,神社聲稱,它是無法找到我在面料的任務已經指定了一個模板:面料和神社模板上傳

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 

它絕對住在那裏。這是怎麼回事?

回答

2

從upload_template文檔字符串:

另外,如果use_jinja設置爲True,你有可用的Jinja2 模板庫,神社將被用來渲染模板 代替。默認情況下,將從調用用戶當前工作的 目錄加載模板,如果給出,將從template_dir加載模板。

不可用行爲。

5

澄清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)