summaryrefslogtreecommitdiffstats
path: root/openstack/common/rpc
diff options
context:
space:
mode:
authorDirk Mueller <dirk@dmllr.de>2013-04-22 03:42:48 +0200
committerDirk Mueller <dirk@dmllr.de>2013-04-22 03:42:48 +0200
commit120ddeff7e1b8956fe35a7a39fae87ddcac8301c (patch)
treeb4eb9b278beca16004e6b1825d8173783390540a /openstack/common/rpc
parent67767b3e8074e4b4a218d7649ef2297c124c342f (diff)
downloadoslo-120ddeff7e1b8956fe35a7a39fae87ddcac8301c.tar.gz
oslo-120ddeff7e1b8956fe35a7a39fae87ddcac8301c.tar.xz
oslo-120ddeff7e1b8956fe35a7a39fae87ddcac8301c.zip
Improve Python 3.x compatibility
Mechanical translation of deprecated constructs to 3.x compatible variants. Change-Id: I4988d0ac656903e0d0320aaa8361d4eeb774a0f9
Diffstat (limited to 'openstack/common/rpc')
-rw-r--r--openstack/common/rpc/common.py4
-rw-r--r--openstack/common/rpc/impl_kombu.py8
-rw-r--r--openstack/common/rpc/impl_qpid.py2
-rw-r--r--openstack/common/rpc/impl_zmq.py2
4 files changed, 8 insertions, 8 deletions
diff --git a/openstack/common/rpc/common.py b/openstack/common/rpc/common.py
index 6fb39e1..2bc7c61 100644
--- a/openstack/common/rpc/common.py
+++ b/openstack/common/rpc/common.py
@@ -276,7 +276,7 @@ def _safe_log(log_func, msg, msg_data):
for elem in arg[:-1]:
d = d[elem]
d[arg[-1]] = '<SANITIZED>'
- except KeyError, e:
+ except KeyError as e:
LOG.info(_('Failed to sanitize %(item)s. Key error %(err)s'),
{'item': arg,
'err': e})
@@ -419,7 +419,7 @@ class ClientException(Exception):
def catch_client_exception(exceptions, func, *args, **kwargs):
try:
return func(*args, **kwargs)
- except Exception, e:
+ except Exception as e:
if type(e) in exceptions:
raise ClientException()
else:
diff --git a/openstack/common/rpc/impl_kombu.py b/openstack/common/rpc/impl_kombu.py
index 18cb0d0..0648e4b 100644
--- a/openstack/common/rpc/impl_kombu.py
+++ b/openstack/common/rpc/impl_kombu.py
@@ -176,7 +176,7 @@ class ConsumerBase(object):
"""Cancel the consuming from the queue, if it has started"""
try:
self.queue.cancel(self.tag)
- except KeyError, e:
+ except KeyError as e:
# NOTE(comstud): Kludge to get around a amqplib bug
if str(e) != "u'%s'" % self.tag:
raise
@@ -520,7 +520,7 @@ class Connection(object):
return
except (IOError, self.connection_errors) as e:
pass
- except Exception, e:
+ except Exception as e:
# NOTE(comstud): Unfortunately it's possible for amqplib
# to return an error not covered by its transport
# connection_errors in the case of a timeout waiting for
@@ -561,10 +561,10 @@ class Connection(object):
while True:
try:
return method(*args, **kwargs)
- except (self.connection_errors, socket.timeout, IOError), e:
+ except (self.connection_errors, socket.timeout, IOError) as e:
if error_callback:
error_callback(e)
- except Exception, e:
+ except Exception as e:
# NOTE(comstud): Unfortunately it's possible for amqplib
# to return an error not covered by its transport
# connection_errors in the case of a timeout waiting for
diff --git a/openstack/common/rpc/impl_qpid.py b/openstack/common/rpc/impl_qpid.py
index f49451f..8e1e450 100644
--- a/openstack/common/rpc/impl_qpid.py
+++ b/openstack/common/rpc/impl_qpid.py
@@ -346,7 +346,7 @@ class Connection(object):
try:
self.connection_create(broker)
self.connection.open()
- except qpid_exceptions.ConnectionError, e:
+ except qpid_exceptions.ConnectionError as e:
msg_dict = dict(e=e, delay=delay)
msg = _("Unable to connect to AMQP server: %(e)s. "
"Sleeping %(delay)s seconds") % msg_dict
diff --git a/openstack/common/rpc/impl_zmq.py b/openstack/common/rpc/impl_zmq.py
index fe880c0..7a5d814 100644
--- a/openstack/common/rpc/impl_zmq.py
+++ b/openstack/common/rpc/impl_zmq.py
@@ -282,7 +282,7 @@ class InternalContext(object):
except greenlet.GreenletExit:
# ignore these since they are just from shutdowns
pass
- except rpc_common.ClientException, e:
+ except rpc_common.ClientException as e:
LOG.debug(_("Expected exception during message handling (%s)") %
e._exc_info[1])
return {'exc':