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
changes/05/468405/1
David Shrewsbury 6 years ago
parent 2852fd598a
commit d1fb0d402e

@ -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:

Loading…
Cancel
Save