You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following lines in network.py:normalize() cause the SSH config 'user' value to be ignored when the task is invoked via execute():
# Only use ssh_config values if the env value appears unmodified from
# the true defaults. If the user has tweaked them, that new value
# takes precedence.
if user == env.local_user and 'user' in conf:
user = conf['user']
The parent task may have a user value that differs from env.local_user so the if condition is False.
The following fabfile reproduces the bug:
from fabric.api import *
@hosts('host2')
def a():
print env.user
def b():
execute('a')
# When .ssh/config has:
# Host host1
# User user1
# Host host2
# User user2
#
# Output:
# $ fab -H host1 a
# user2
# $ fab -H host1 b
# user1
#
# A different user value is set depending on whether task 'a' was invoked from
# the command-line or via execute()!
#
# The expected output is:
# $ fab -H host1 b
# user2
The text was updated successfully, but these errors were encountered:
After discussing with redkrieg on IRC I think comparing against a user value in network.py:normalize() is wrong in the first place. If the user manually overrides env.user but happens to use same username as env.local_user they're not supposed to get the ssh config User value, but the current code will treat it as if it's okay to apply ssh config User.
The following lines in network.py:normalize() cause the SSH config 'user' value to be ignored when the task is invoked via execute():
The parent task may have a user value that differs from env.local_user so the if condition is False.
The following fabfile reproduces the bug:
The text was updated successfully, but these errors were encountered: