fabric/fabric — Issue #507: env.path + sudo results in wrong ordering
Author: teichopsia
Created: 2011-12-18 13:49:12+00:00
State: open

Ok, so using fabric 1.3.3 from virtualenv/pip install and comparing to the dev track and it appears a bug I've patched locally may exist still:

operations.py -- _run_command, the invocation of _shell_wrap tries to use _prefix_env_vars to adjust the command to include the env.path. this is fine for run. sudo however will fail as the PATH would need to preceed the sudo_prefix.

*** 856,864 ****
given_command = command
# Handle context manager modifications, and shell wrapping
wrapped_command = _shell_wrap(
! _prefix_commands(_prefix_env_vars(command), 'remote'),
shell,
! _sudo_prefix(user) if sudo else None
)
# Execute info line
which = 'sudo' if sudo else 'run'
--- 851,859 ----
given_command = command
# Handle context manager modifications, and shell wrapping
wrapped_command = _shell_wrap(
! command,
shell,
! _prefix_env_vars('')+_sudo_prefix(user) if sudo else _prefix_env_vars('')
)
# Execute info line
which = 'sudo' if sudo else 'run'

that's my temp hack as it doesn't seem to be a clean mechanism for generic ENV modification just yet. You get the idea though. I'm sure there's a cleaner way but that's the poc.