Include ip address for ssh_connect exception

Add some sort of server information about our failed ssh_connect
attempts.  Currently we don't expose any information about the host.

2016-08-23 16:26:11,894 ERROR nodepool.utils: Exception while testing ssh access:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nodepool/", line 55, in ssh_connect
    client = SSHClient(ip, username, **connect_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nodepool/", line 30, in __init__
  File "/usr/local/lib/python2.7/dist-packages/paramiko/", line 305, in connect
    retry_on_signal(lambda: sock.connect(addr))
  File "/usr/local/lib/python2.7/dist-packages/paramiko/", line 270, in retry_on_signal
    return function()
  File "/usr/local/lib/python2.7/dist-packages/paramiko/", line 305, in <lambda>
    retry_on_signal(lambda: sock.connect(addr))
  File "/usr/lib/python2.7/", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 110] Connection timed out

Change-Id: I5705798c91b228a7be2788c33c5a128653b24bbe
Signed-off-by: Paul Belanger <>
Paul Belanger 7 years ago
parent 02b591ad9e
commit c4d19c1a18
No known key found for this signature in database
GPG Key ID: 611A80832067AF38

@ -61,7 +61,8 @@ def ssh_connect(ip, username, connect_kwargs={}, timeout=60):
(username, ip, count))
except socket.error as e:
if e[0] not in [errno.ECONNREFUSED, errno.EHOSTUNREACH, None]:
log.exception('Exception while testing ssh access:')
'Exception while testing ssh access to %s:' % ip)
out = client.ssh("test ssh access", "echo access okay", output=True)
if "access okay" in out: