{"action":"created","issue":{"url":"https://api.github.com/repos/fabric/fabric/issues/1847","repository_url":"https://api.github.com/repos/fabric/fabric","labels_url":"https://api.github.com/repos/fabric/fabric/issues/1847/labels{/name}","comments_url":"https://api.github.com/repos/fabric/fabric/issues/1847/comments","events_url":"https://api.github.com/repos/fabric/fabric/issues/1847/events","html_url":"https://github.com/fabric/fabric/issues/1847","id":349785795,"node_id":"MDU6SXNzdWUzNDk3ODU3OTU=","number":1847,"title":"Fabric1 upload_templat, env.variable template replacement specification","user":{"login":"3kami3","id":12627100,"node_id":"MDQ6VXNlcjEyNjI3MTAw","avatar_url":"https://avatars2.githubusercontent.com/u/12627100?v=4","gravatar_id":"","url":"https://api.github.com/users/3kami3","html_url":"https://github.com/3kami3","followers_url":"https://api.github.com/users/3kami3/followers","following_url":"https://api.github.com/users/3kami3/following{/other_user}","gists_url":"https://api.github.com/users/3kami3/gists{/gist_id}","starred_url":"https://api.github.com/users/3kami3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3kami3/subscriptions","organizations_url":"https://api.github.com/users/3kami3/orgs","repos_url":"https://api.github.com/users/3kami3/repos","events_url":"https://api.github.com/users/3kami3/events{/privacy}","received_events_url":"https://api.github.com/users/3kami3/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-12T05:20:24Z","updated_at":"2018-08-13T06:15:06Z","closed_at":"2018-08-13T06:15:06Z","author_association":"NONE","body":"Is this a specification? Or is it a bug?\r\nI would like the env variable to be replaced with a template by the jinja2 mechanism.\r\n\r\n```\r\n$ cat fabfile.py\r\nfrom fabric.api import env\r\nfrom fabric.contrib.files import upload_template\r\n\r\ndef upload():\r\n    upload_template(\r\n      \"template.j2\",\r\n      \"/tmp/test/template.txt\",\r\n      context={\r\n        'teststr' : \"123\\n456\\n789\",\r\n        'teststr2': env.TESTSTR,\r\n      },\r\n      use_jinja=True,\r\n    )\r\n\r\n$ cat rcfile\r\nTESTSTR=123\\n456\\n789\r\n\r\n$ cat template.j2\r\n{{ teststr }}\r\n{{ teststr2 }}\r\nEOF\r\n```\r\n```\r\n# fab -H localhost -c rcfile upload\r\n[localhost] Executing task 'upload'\r\n[localhost] Login password for 'root':\r\n[localhost] put: <file obj> -> /tmp/test/template.txt\r\n\r\nDone.\r\nDisconnecting from localhost... done.\r\n\r\n# cat template.txt\r\n123\r\n456\r\n789\r\n123\\n456\\n789\r\nEOF\r\n```\r\n```\r\n# python --version\r\nPython 2.7.15\r\n\r\n# pip list\r\nPackage      Version\r\n------------ -------\r\nasn1crypto   0.24.0\r\nbcrypt       3.1.4\r\ncffi         1.11.5\r\ncryptography 2.3\r\nenum34       1.1.6\r\nFabric       1.14.0\r\nidna         2.7\r\nipaddress    1.0.22\r\nJinja2       2.10\r\nMarkupSafe   1.0\r\nparamiko     2.4.1\r\npip          18.0\r\npyasn1       0.4.4\r\npycparser    2.18\r\nPyNaCl       1.2.1\r\nsetuptools   40.0.0\r\nsix          1.11.0\r\nvirtualenv   16.0.0\r\nwheel        0.31.1\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/fabric/fabric/issues/comments/412417882","html_url":"https://github.com/fabric/fabric/issues/1847#issuecomment-412417882","issue_url":"https://api.github.com/repos/fabric/fabric/issues/1847","id":412417882,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjQxNzg4Mg==","user":{"login":"3kami3","id":12627100,"node_id":"MDQ6VXNlcjEyNjI3MTAw","avatar_url":"https://avatars2.githubusercontent.com/u/12627100?v=4","gravatar_id":"","url":"https://api.github.com/users/3kami3","html_url":"https://github.com/3kami3","followers_url":"https://api.github.com/users/3kami3/followers","following_url":"https://api.github.com/users/3kami3/following{/other_user}","gists_url":"https://api.github.com/users/3kami3/gists{/gist_id}","starred_url":"https://api.github.com/users/3kami3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3kami3/subscriptions","organizations_url":"https://api.github.com/users/3kami3/orgs","repos_url":"https://api.github.com/users/3kami3/repos","events_url":"https://api.github.com/users/3kami3/events{/privacy}","received_events_url":"https://api.github.com/users/3kami3/received_events","type":"User","site_admin":false},"created_at":"2018-08-13T06:15:06Z","updated_at":"2018-08-13T06:15:06Z","author_association":"NONE","body":"It solved by your code.\r\nThank you.  :thumbsup:\r\nI will close it."}}
{"actor":{"display_login":"3kami3"}}