summaryrefslogtreecommitdiff
path: root/paramiko/agent.py
diff options
context:
space:
mode:
authorKen Jordan <ken@holeintheground.us>2015-01-22 19:39:22 -0700
committerJeff Forcier <jeff@bitprophet.org>2015-02-04 15:53:19 -0800
commit3700d6e151d7891a12b958cf8f2729576205d927 (patch)
tree38d1d1a4b1460fefd76523147afa754d96ecf300 /paramiko/agent.py
parent85d5e95f9280aa236602b77e9f5bd0aa4d3c8fcd (diff)
downloadparamiko-3700d6e151d7891a12b958cf8f2729576205d927.tar.gz
Updated agent.py to print a more appropriate exception when unable to connect to the SSH agent
Diffstat (limited to 'paramiko/agent.py')
-rw-r--r--paramiko/agent.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/paramiko/agent.py b/paramiko/agent.py
index a75ac59e..185666e7 100644
--- a/paramiko/agent.py
+++ b/paramiko/agent.py
@@ -32,7 +32,7 @@ from select import select
from paramiko.common import asbytes, io_sleep
from paramiko.py3compat import byte_chr
-from paramiko.ssh_exception import SSHException
+from paramiko.ssh_exception import SSHException, AuthenticationException
from paramiko.message import Message
from paramiko.pkey import PKey
from paramiko.util import retry_on_signal
@@ -109,9 +109,15 @@ 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
self.__inr = r
- self.__addr = addr
+ self.__addr = addr # This should be an IP address as a string? or None
self._agent.connect()
+ print("Conn Value: ", self._agent._conn)
+ print("Has fileno method: ", hasattr(self._agent._conn, 'fileno'))
+ print("Verify isinstance of int: ", isinstance(self._agent, int))
+ if self._agent._conn is None or not (hasattr(self._agent._conn, 'fileno') or isinstance(self._agent, int)):
+ raise AuthenticationException("Unable to connect to SSH agent")
self._communicate()
except:
#XXX Not sure what to do here ... raise or pass ?