Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch '1.6'

Conflicts:
	docs/changelog.rst
  • Loading branch information...
commit e2fad3045e6b4d55cb9716695eb7457255365553 2 parents 2d13a1c + 138b1cb
@bitprophet bitprophet authored
View
2  .travis.yml
@@ -19,7 +19,7 @@ before_script:
- "netstat -tan | grep LISTEN"
script:
# Normal tests
- #- fab test
+ - fab test
# Integration tests
- fab test:"--tests\=integration"
notifications:
View
11 docs/changelog.rst
@@ -28,9 +28,18 @@ Changelog
* :bug:`844` Allow users to disable Fabric's auto-escaping in `.run`/`.sudo`.
Thanks to Christian Long and Michael McHugh for the patch.
* :bug:`84` Fixed problem with missing -r flag in Mac OS X sed version.
+* :bug:`870` Changes to shell env var escaping highlighted some extraneous and
+ now damaging whitespace in `with path(): <.path>`. This has been removed and
+ a regression test added.
+* :bug:`871` Use of string mode values in `put(local, remote, mode="NNNN")
+ <.put>` would sometimes cause ``Unsupported operand`` errors. This has been
+ fixed.
+* :bug:`84` Fixed problem with missing -r flag in Mac OS X sed version. Thanks
+ to Konrad Hałas for the patch.
* :bug:`861` Gracefully handle situations where users give a single string
literal to ``env.hosts``. Thanks to Bill Tucker for catch & patch.
-* :bug:`367` Expand paths with tilde inside (``contrib.files``).
+* :bug:`367` Expand paths with tilde inside (``contrib.files``). Thanks to
+ Konrad Hałas for catch & patch.
* :feature:`845` Downstream synchronization option implemented for
`~fabric.contrib.project.rsync_project`. Thanks to Antonio Barrero for the
patch.
View
6 fabric/operations.py
@@ -665,11 +665,11 @@ def _prefix_env_vars(command, local=False):
path = env.path
if path:
if env.path_behavior == 'append':
- path = '$PATH:\"%s\" ' % path
+ path = '$PATH:\"%s\"' % path
elif env.path_behavior == 'prepend':
- path = '\"%s\":$PATH ' % path
+ path = '\"%s\":$PATH' % path
elif env.path_behavior == 'replace':
- path = '\"%s\" ' % path
+ path = '\"%s\"' % path
env_vars['PATH'] = path
View
8 fabric/sftp.py
@@ -230,8 +230,14 @@ def put(self, local_path, remote_path, use_sudo, mirror_local_mode, mode,
# Handle modes if necessary
if (local_is_path and mirror_local_mode) or (mode is not None):
lmode = os.stat(local_path).st_mode if mirror_local_mode else mode
+ # Cast to octal integer in case of string
+ if isinstance(lmode, basestring):
+ lmode = int(lmode, 8)
lmode = lmode & 07777
- rmode = rattrs.st_mode & 07777
+ rmode = rattrs.st_mode
+ # Only bitshift if we actually got an rmode
+ if rmode is not None:
+ rmode = (rmode & 07777)
if lmode != rmode:
if use_sudo:
with hide('everything'):
View
7 integration/test_contrib.py
@@ -1,12 +1,9 @@
import types
-from fabric.api import env, run, local
+from fabric.api import run, local
from fabric.contrib import files
-
-class Integration(object):
- def setup(self):
- env.host_string = "127.0.0.1"
+from util import Integration
def tildify(path):
View
36 integration/test_operations.py
@@ -0,0 +1,36 @@
+from __future__ import with_statement
+
+from StringIO import StringIO
+
+from fabric.api import run, path, put
+
+from util import Integration
+
+
+def assert_mode(path, mode):
+ assert run("stat -c \"%%a\" %s" % path).stdout == mode
+
+
+class TestOperations(Integration):
+ filepath = "/tmp/whocares"
+ dirpath = "/tmp/whatever/bin"
+
+ def setup(self):
+ super(TestOperations, self).setup()
+ # Nuke to prevent bleed
+ run("rm -rf %s %s" % (self.dirpath, self.filepath))
+ # Setup just for kicks
+ run("mkdir -p %s" % self.dirpath)
+
+ def test_no_trailing_space_in_shell_path_in_run(self):
+ put(StringIO("#!/bin/bash\necho hi"), "%s/myapp" % self.dirpath, mode="0755")
+ with path(self.dirpath):
+ assert run('myapp').stdout == 'hi'
+
+ def test_string_put_mode_arg_doesnt_error(self):
+ put(StringIO("#!/bin/bash\necho hi"), self.filepath, mode="0755")
+ assert_mode(self.filepath, "755")
+
+ def test_int_put_mode_works_ok_too(self):
+ put(StringIO("#!/bin/bash\necho hi"), self.filepath, mode=0755)
+ assert_mode(self.filepath, "755")
View
6 integration/util.py
@@ -0,0 +1,6 @@
+from fabric.api import env
+
+
+class Integration(object):
+ def setup(self):
+ env.host_string = "127.0.0.1"
Please sign in to comment.
Something went wrong with that request. Please try again.