diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-04-22 13:35:28 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-04-22 13:35:28 +0000 |
| commit | 2492387789ece466e19ee1a76ce5f574bfc123e6 (patch) | |
| tree | 206b84ddf2e326980b77d74a4c8633a7034cd091 /openstack/common/rpc | |
| parent | 572bb9ddb720c7cf948906c72be30b022ded0df0 (diff) | |
| parent | 120ddeff7e1b8956fe35a7a39fae87ddcac8301c (diff) | |
| download | oslo-2492387789ece466e19ee1a76ce5f574bfc123e6.tar.gz oslo-2492387789ece466e19ee1a76ce5f574bfc123e6.tar.xz oslo-2492387789ece466e19ee1a76ce5f574bfc123e6.zip | |
Merge "Improve Python 3.x compatibility"
Diffstat (limited to 'openstack/common/rpc')
| -rw-r--r-- | openstack/common/rpc/common.py | 4 | ||||
| -rw-r--r-- | openstack/common/rpc/impl_kombu.py | 8 | ||||
| -rw-r--r-- | openstack/common/rpc/impl_qpid.py | 2 | ||||
| -rw-r--r-- | openstack/common/rpc/impl_zmq.py | 2 |
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': |
