Suppress NoValidConnectionsError from paramiko
New versions of paramiko wrap exceptions from multiple connection attempts for multiple address families into one NoValidConnectionsError exception. It is a subclass of socket.error but with an errno set to None. Just check for that and ignore it to supress log entries on perfectly normal connection failures. Change-Id: If64ab66dcc6db7c1886fb72f36078f7f819d6506
This commit is contained in:
parent
23efca041c
commit
5bcccf7605
|
@ -56,7 +56,7 @@ def ssh_connect(ip, username, connect_kwargs={}, timeout=60):
|
||||||
# after sshd is up (Fedora for example)
|
# after sshd is up (Fedora for example)
|
||||||
log.info('Password auth exception. Try number %i...' % count)
|
log.info('Password auth exception. Try number %i...' % count)
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
if e[0] not in [errno.ECONNREFUSED, errno.EHOSTUNREACH]:
|
if e[0] not in [errno.ECONNREFUSED, errno.EHOSTUNREACH, None]:
|
||||||
log.exception('Exception while testing ssh access:')
|
log.exception('Exception while testing ssh access:')
|
||||||
|
|
||||||
out = client.ssh("test ssh access", "echo access okay", output=True)
|
out = client.ssh("test ssh access", "echo access okay", output=True)
|
||||||
|
|
Loading…
Reference in New Issue