diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2017-05-31 18:21:48 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2017-05-31 18:21:48 -0700 |
commit | 86815346590cc8c460a67ff2862c925c07214f09 (patch) | |
tree | 3fef6d43f5acc6e994c6b7cceb7ca832299e5b3a /paramiko/agent.py | |
parent | 15aa741ba245b7384e6af4f4eb095431cfec4c19 (diff) | |
parent | 383e102b54464f2be8fe5aaa3b1e9bd94ad0b788 (diff) |
Merge branch '2.0'
Diffstat (limited to 'paramiko/agent.py')
-rw-r--r-- | paramiko/agent.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/paramiko/agent.py b/paramiko/agent.py index c13810bb..a7cab4d8 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -109,15 +109,23 @@ class AgentProxyThread(threading.Thread): def run(self): try: (r, addr) = self.get_connection() - # Found that r should be either a socket from the socket library or None + # Found that r should be either + # a socket from the socket library or None self.__inr = r - self.__addr = addr # This should be an IP address as a string? or None + # The address should be an IP address as a string? or None + self.__addr = addr self._agent.connect() - if not isinstance(self._agent, int) and (self._agent._conn is None or not hasattr(self._agent._conn, 'fileno')): + if ( + not isinstance(self._agent, int) and + ( + self._agent._conn is None or + not hasattr(self._agent._conn, 'fileno') + ) + ): raise AuthenticationException("Unable to connect to SSH agent") self._communicate() except: - #XXX Not sure what to do here ... raise or pass ? + # XXX Not sure what to do here ... raise or pass ? raise def _communicate(self): @@ -213,7 +221,8 @@ class AgentClientProxy(object): if ('SSH_AUTH_SOCK' in os.environ) and (sys.platform != 'win32'): conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) try: - retry_on_signal(lambda: conn.connect(os.environ['SSH_AUTH_SOCK'])) + retry_on_signal( + lambda: conn.connect(os.environ['SSH_AUTH_SOCK'])) except: # probably a dangling env var: the ssh agent is gone return |