Closed
Description
fabric.contrib.files.upload_template
relies on brace expansion to create the backup file - eg.
cp "$(echo report.txt)"{,.bak}
This fails if env.shell
does not support brace expansion (which is true for /bin/sh).
The following patch fixes the issue.
diff --git a/fabric/contrib/files.py b/fabric/contrib/files.py
index 5db5b31..ef2515f 100644
--- a/fabric/contrib/files.py
+++ b/fabric/contrib/files.py
@@ -150,7 +150,9 @@ def upload_template(filename, destination, context=None, use
# Back up original file
if backup and exists(destination):
- func("cp %s{,.bak}" % _expand_path(destination))
+ orig = _expand_path(destination)
+ bak = _expand_path(destination + ".bak")
+ func("cp %s %s" % (orig,bak))
# Upload the file.
return put(