Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
The tests have a bug when a developer's host has its own ssh config
that sets agent forwarding to the nondefault.
  • Loading branch information
offbyone committed May 16, 2018
1 parent 15c933d commit 85c2512
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions fabric/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,7 @@ def __init__(
forward_agent = self.config.forward_agent
# But if ssh_config is present, it wins
if "forwardagent" in self.ssh_config:
# TODO: SSHConfig really, seriously needs some love here, god
map_ = {"yes": True, "no": False}
forward_agent = map_[self.ssh_config["forwardagent"]]
forward_agent = self.ssh_config.as_bool("forwardagent")
#: Whether agent forwarding is enabled.
self.forward_agent = forward_agent

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

install_requires=[
'invoke>=1.0,<2.0',
'paramiko>=2.4',
'paramiko>=2.5',
'cryptography>=1.1',
],
packages=[package_name],
Expand Down
5 changes: 3 additions & 2 deletions tests/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ def shorthand_wins_over_config(self):

class forward_agent:

def defaults_to_False(self):
assert Connection("host").forward_agent is False
def defaults_to_connection_config_value(self):
conn = Connection("host")
assert conn.forward_agent is conn.ssh_config.as_bool("forwardagent")

def accepts_configuration_value(self):
config = Config(
Expand Down

0 comments on commit 85c2512

Please sign in to comment.