summaryrefslogtreecommitdiffstats
path: root/nova/openstack
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-05-16 00:04:49 +0000
committerGerrit Code Review <review@openstack.org>2013-05-16 00:04:49 +0000
commit1e9937e327fa87d783c491bb3874b8c79d013108 (patch)
tree0051c7134b267db945673b13413d7e47c92b02e6 /nova/openstack
parent3eee243123c47d81c2fa3f020645da1623803dd2 (diff)
parentfac5eb871a8dae03aad6fdc705cd0bc266b19e88 (diff)
downloadnova-1e9937e327fa87d783c491bb3874b8c79d013108.tar.gz
nova-1e9937e327fa87d783c491bb3874b8c79d013108.tar.xz
nova-1e9937e327fa87d783c491bb3874b8c79d013108.zip
Merge "Sync rpc from oslo."
Diffstat (limited to 'nova/openstack')
-rw-r--r--nova/openstack/common/rpc/common.py6
-rw-r--r--nova/openstack/common/rpc/impl_qpid.py2
-rw-r--r--nova/openstack/common/rpc/impl_zmq.py4
-rw-r--r--nova/openstack/common/rpc/matchmaker.py2
4 files changed, 8 insertions, 6 deletions
diff --git a/nova/openstack/common/rpc/common.py b/nova/openstack/common/rpc/common.py
index 3c8d56938..4b2e5a71f 100644
--- a/nova/openstack/common/rpc/common.py
+++ b/nova/openstack/common/rpc/common.py
@@ -22,6 +22,7 @@ import sys
import traceback
from oslo.config import cfg
+import six
from nova.openstack.common.gettextutils import _
from nova.openstack.common import importutils
@@ -299,7 +300,8 @@ def serialize_remote_exception(failure_info, log_failure=True):
tb = traceback.format_exception(*failure_info)
failure = failure_info[1]
if log_failure:
- LOG.error(_("Returning exception %s to caller"), unicode(failure))
+ LOG.error(_("Returning exception %s to caller"),
+ six.text_type(failure))
LOG.error(tb)
kwargs = {}
@@ -309,7 +311,7 @@ def serialize_remote_exception(failure_info, log_failure=True):
data = {
'class': str(failure.__class__.__name__),
'module': str(failure.__class__.__module__),
- 'message': unicode(failure),
+ 'message': six.text_type(failure),
'tb': tb,
'args': failure.args,
'kwargs': kwargs
diff --git a/nova/openstack/common/rpc/impl_qpid.py b/nova/openstack/common/rpc/impl_qpid.py
index 93d2602dd..2863f23a5 100644
--- a/nova/openstack/common/rpc/impl_qpid.py
+++ b/nova/openstack/common/rpc/impl_qpid.py
@@ -375,7 +375,7 @@ class Connection(object):
try:
return method(*args, **kwargs)
except (qpid_exceptions.Empty,
- qpid_exceptions.ConnectionError), e:
+ qpid_exceptions.ConnectionError) as e:
if error_callback:
error_callback(e)
self.reconnect()
diff --git a/nova/openstack/common/rpc/impl_zmq.py b/nova/openstack/common/rpc/impl_zmq.py
index a2c5fa36a..092fc6953 100644
--- a/nova/openstack/common/rpc/impl_zmq.py
+++ b/nova/openstack/common/rpc/impl_zmq.py
@@ -180,7 +180,7 @@ class ZmqSocket(object):
return
# We must unsubscribe, or we'll leak descriptors.
- if len(self.subscriptions) > 0:
+ if self.subscriptions:
for f in self.subscriptions:
try:
self.sock.setsockopt(zmq.UNSUBSCRIBE, f)
@@ -763,7 +763,7 @@ def _multi_send(method, context, topic, msg, timeout=None,
LOG.debug(_("Sending message(s) to: %s"), queues)
# Don't stack if we have no matchmaker results
- if len(queues) == 0:
+ if not queues:
LOG.warn(_("No matchmaker results. Not casting."))
# While not strictly a timeout, callers know how to handle
# this exception and a timeout isn't too big a lie.
diff --git a/nova/openstack/common/rpc/matchmaker.py b/nova/openstack/common/rpc/matchmaker.py
index dcee752b2..b21420fa6 100644
--- a/nova/openstack/common/rpc/matchmaker.py
+++ b/nova/openstack/common/rpc/matchmaker.py
@@ -245,7 +245,7 @@ class HeartbeatMatchMakerBase(MatchMakerBase):
yielding for CONF.matchmaker_heartbeat_freq seconds
between iterations.
"""
- if len(self.hosts) == 0:
+ if not self.hosts:
raise MatchMakerException(
_("Register before starting heartbeat."))