Fix socket.error exception usage

This exception is not subscriptable in py3, but the proper way to
get to the errno in any version is to access the 'errno' attribute.

Change-Id: I9a2e23cee358ff0f573f29962ab03525bfd40974
This commit is contained in:
David Shrewsbury 2017-05-26 08:43:00 -04:00
parent 2852fd598a
commit d1fb0d402e
1 changed files with 1 additions and 1 deletions

View File

@ -74,7 +74,7 @@ def keyscan(ip, timeout=60):
key = t.get_remote_server_key()
break
except socket.error as e:
if e[0] not in [errno.ECONNREFUSED, errno.EHOSTUNREACH, None]:
if e.errno not in [errno.ECONNREFUSED, errno.EHOSTUNREACH, None]:
log.exception(
'Exception with ssh access to %s:' % ip)
except Exception as e: