sebastien / cuisine

Chef-like functionality for Fabric
Other
1.26k stars 156 forks source link

run_local doesn't respect prefixes #120

Open rabialam opened 11 years ago

sebastien commented 11 years ago

Hi! Could you please elaborate on this issue, I'm not sure to understand what the problem is. Thanks!

rabialam commented 11 years ago

Sure thing. When you use run_local, it just creates a subprocess.Popen object, and executes that command line basically raw. I basically clipped a few lines from fabric.api.operations to wrap around any prefix contexts blocks that run_local is operating inside in, as well as any sudo context blocks. Otherwise, supposed I wanted to prefix a few blocks with something like this:

with prefix('workon myproj'):
    with prefix('cd subdir/dir'):
        run_local('pwd');

Without the fix, this would evaluate to bash -l -c "pwd" instead of the desired bash -l -c "workon myproj && cd subdir/dir && pwd".

Also, I made a small fix (though this commit is something different) to make the package installable via pip from a git commit number -- there's still an issue pip right now where if you use packages that have a directory structure with your main package inside of a src/<main_file.py> format, pip for some reason will only retain the version number instead of properly persisting the commit and repository url as it should, which causes a maintainability nightmare. Not sure if that particular commit belongs with this issue, though.