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:
James E. Blair 2015-11-25 17:22:43 -08:00
parent 23efca041c
commit 5bcccf7605
1 changed files with 1 additions and 1 deletions

View File

@ -56,7 +56,7 @@ def ssh_connect(ip, username, connect_kwargs={}, timeout=60):
# after sshd is up (Fedora for example)
log.info('Password auth exception. Try number %i...' % count)
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:')
out = client.ssh("test ssh access", "echo access okay", output=True)