Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
path() context manager no longer works with local() #775
The path() context manager stopped working for the local() operation in Fabric 1.5. It was working under 1.4.3.
We use the path context manager to add our local virtualenv's bin directory to our fabfile. Assuming that the virtualenv is in './env' relative to the fabfile, here is a task that shows the bug:
@task def test_path(): with path('env/bin', behavior='prepend'): local('echo $PATH') local('which pip')
Everything works under Fabric 1.4.3:
It breaks under Fabric 1.5.0:
This also appears to happen without the context manager. Here is some code that triggers the same error:
$ fab dev provision -u vagrant -f vagrant.py [127.0.0.1:2222] Executing task 'provision' [127.0.0.1:2222] sudo: mkdir -p /var/chef [localhost] local: echo $PATH $PATH:"/home/pindrop/pindrop" [localhost] local: mkdir /tmp/tmpsnf_qP/cookbooks /bin/sh: 1: mkdir: not found Fatal error: local() encountered an error (return code 127) while executing 'mkdir /tmp/tmpsnf_qP/cookbooks' Aborting. Fatal error: One or more hosts failed while executing task 'provision' Aborting.
Note: I've squeezed a
I have a test case reproducing it and believe I know the cause: the string
Still determining exactly what causes this (the spots I've checked so far that would be related, appear to be unchanged since 1.4) but I do recall changes to the shell escaping so those may be at fault.
If that is correct, I will either revert those changes with a note to the committer, or (ideally) try moving this specific part of the env var updating to occur after the escaping. (This does mean that folks wanting literal dollar signs/etc in their PATH values, will get hosed, but given this change probably went out recently, I am not worried about impact.)
I just ran a
1010359 is the first bad commit