Use except x as y instead of except x, y
According to https://docs.python.org/3/howto/pyporting.html the syntax changed in Python 3.x. The new syntax is usable with Python >= 2.6 and should be preferred to be compatible with Python3. Enabled hacking check H231. Change-Id: Ide60f971493440311f1dcc594e33d536beb925e5
This commit is contained in:
parent
f03b6d6aa7
commit
e3dd94d65c
@ -330,7 +330,7 @@ class NodeLauncher(threading.Thread):
|
|||||||
dt = self.launchNode(session)
|
dt = self.launchNode(session)
|
||||||
failed = False
|
failed = False
|
||||||
statsd_key = 'ready'
|
statsd_key = 'ready'
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
self.log.exception("%s launching node id: %s "
|
self.log.exception("%s launching node id: %s "
|
||||||
"in provider: %s error:" %
|
"in provider: %s error:" %
|
||||||
(e.__class__.__name__,
|
(e.__class__.__name__,
|
||||||
@ -571,7 +571,7 @@ class SubNodeLauncher(threading.Thread):
|
|||||||
dt = self.launchSubNode(session)
|
dt = self.launchSubNode(session)
|
||||||
failed = False
|
failed = False
|
||||||
statsd_key = 'ready'
|
statsd_key = 'ready'
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
self.log.exception("%s launching subnode id: %s "
|
self.log.exception("%s launching subnode id: %s "
|
||||||
"for node id: %s in provider: %s error:" %
|
"for node id: %s in provider: %s error:" %
|
||||||
(e.__class__.__name__, self.subnode_id,
|
(e.__class__.__name__, self.subnode_id,
|
||||||
|
@ -47,11 +47,11 @@ def ssh_connect(ip, username, connect_kwargs={}, timeout=60):
|
|||||||
try:
|
try:
|
||||||
client = SSHClient(ip, username, **connect_kwargs)
|
client = SSHClient(ip, username, **connect_kwargs)
|
||||||
break
|
break
|
||||||
except paramiko.AuthenticationException, e:
|
except paramiko.AuthenticationException as e:
|
||||||
# This covers the case where the cloud user is created
|
# This covers the case where the cloud user is created
|
||||||
# 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, e:
|
except socket.error as e:
|
||||||
if e[0] not in [errno.ECONNREFUSED, errno.EHOSTUNREACH]:
|
if e[0] not in [errno.ECONNREFUSED, errno.EHOSTUNREACH]:
|
||||||
log.exception('Exception while testing ssh access:')
|
log.exception('Exception while testing ssh access:')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user