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:
Christian Berendt 2014-05-29 23:57:26 +02:00
parent f03b6d6aa7
commit e3dd94d65c
3 changed files with 5 additions and 4 deletions

View File

@ -330,7 +330,7 @@ class NodeLauncher(threading.Thread):
dt = self.launchNode(session)
failed = False
statsd_key = 'ready'
except Exception, e:
except Exception as e:
self.log.exception("%s launching node id: %s "
"in provider: %s error:" %
(e.__class__.__name__,
@ -571,7 +571,7 @@ class SubNodeLauncher(threading.Thread):
dt = self.launchSubNode(session)
failed = False
statsd_key = 'ready'
except Exception, e:
except Exception as e:
self.log.exception("%s launching subnode id: %s "
"for node id: %s in provider: %s error:" %
(e.__class__.__name__, self.subnode_id,

View File

@ -47,11 +47,11 @@ def ssh_connect(ip, username, connect_kwargs={}, timeout=60):
try:
client = SSHClient(ip, username, **connect_kwargs)
break
except paramiko.AuthenticationException, e:
except paramiko.AuthenticationException as e:
# This covers the case where the cloud user is created
# after sshd is up (Fedora for example)
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]:
log.exception('Exception while testing ssh access:')

View File

@ -27,5 +27,6 @@ commands = {posargs}
[flake8]
ignore = E123,E125,H
select = H231
show-source = True
exclude = .venv,.tox,dist,doc,build,*.egg