diff options
author | Andrew Bogott <abogott@wikimedia.org> | 2012-07-08 06:08:24 -0500 |
---|---|---|
committer | Andrew Bogott <abogott@wikimedia.org> | 2012-07-08 06:35:59 -0500 |
commit | 688f9274a803e40c20dfc9275ad2246e674a6062 (patch) | |
tree | d22c4c164fccd40daaff169c627b21a8afd970eb /nova/openstack | |
parent | 647684adf2514fe9f0a1f142871f489bcd4a1c1a (diff) | |
download | nova-688f9274a803e40c20dfc9275ad2246e674a6062.tar.gz nova-688f9274a803e40c20dfc9275ad2246e674a6062.tar.xz nova-688f9274a803e40c20dfc9275ad2246e674a6062.zip |
Janitorial: Catch rpc up with a change in common
Common rpc now uses jsonutils instead of json; this
patch moves that change into nova.
Change-Id: Iba45e473ae875b0973dbe6f752602b58c7980578
Diffstat (limited to 'nova/openstack')
-rw-r--r-- | nova/openstack/common/notifier/log_notifier.py | 4 | ||||
-rw-r--r-- | nova/openstack/common/rpc/impl_fake.py | 4 | ||||
-rw-r--r-- | nova/openstack/common/rpc/impl_qpid.py | 6 | ||||
-rw-r--r-- | nova/openstack/common/rpc/impl_zmq.py | 7 |
4 files changed, 11 insertions, 10 deletions
diff --git a/nova/openstack/common/notifier/log_notifier.py b/nova/openstack/common/notifier/log_notifier.py index 5bf0ce3b8..ede96a019 100644 --- a/nova/openstack/common/notifier/log_notifier.py +++ b/nova/openstack/common/notifier/log_notifier.py @@ -13,9 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -import json from nova.openstack.common import cfg +from nova.openstack.common import jsonutils from nova.openstack.common import log as logging @@ -31,4 +31,4 @@ def notify(_context, message): priority = priority.lower() logger = logging.getLogger( 'nova.openstack.common.notification.%s' % message['event_type']) - getattr(logger, priority)(json.dumps(message)) + getattr(logger, priority)(jsonutils.dumps(message)) diff --git a/nova/openstack/common/rpc/impl_fake.py b/nova/openstack/common/rpc/impl_fake.py index 07e8bdc08..8db0da015 100644 --- a/nova/openstack/common/rpc/impl_fake.py +++ b/nova/openstack/common/rpc/impl_fake.py @@ -18,11 +18,11 @@ queues. Casts will block, but this is very useful for tests. """ import inspect -import json import time import eventlet +from nova.openstack.common import jsonutils from nova.openstack.common.rpc import common as rpc_common CONSUMERS = {} @@ -121,7 +121,7 @@ def create_connection(conf, new=True): def check_serialize(msg): """Make sure a message intended for rpc can be serialized.""" - json.dumps(msg) + jsonutils.dumps(msg) def multicall(conf, context, topic, msg, timeout=None): diff --git a/nova/openstack/common/rpc/impl_qpid.py b/nova/openstack/common/rpc/impl_qpid.py index 2eb1dfa7e..202988faf 100644 --- a/nova/openstack/common/rpc/impl_qpid.py +++ b/nova/openstack/common/rpc/impl_qpid.py @@ -17,7 +17,6 @@ import functools import itertools -import json import logging import time import uuid @@ -29,6 +28,7 @@ import qpid.messaging.exceptions from nova.openstack.common import cfg from nova.openstack.common.gettextutils import _ +from nova.openstack.common import jsonutils from nova.openstack.common.rpc import amqp as rpc_amqp from nova.openstack.common.rpc import common as rpc_common @@ -125,7 +125,7 @@ class ConsumerBase(object): addr_opts["node"]["x-declare"].update(node_opts) addr_opts["link"]["x-declare"].update(link_opts) - self.address = "%s ; %s" % (node_name, json.dumps(addr_opts)) + self.address = "%s ; %s" % (node_name, jsonutils.dumps(addr_opts)) self.reconnect(session) @@ -230,7 +230,7 @@ class Publisher(object): if node_opts: addr_opts["node"]["x-declare"].update(node_opts) - self.address = "%s ; %s" % (node_name, json.dumps(addr_opts)) + self.address = "%s ; %s" % (node_name, jsonutils.dumps(addr_opts)) self.reconnect(session) diff --git a/nova/openstack/common/rpc/impl_zmq.py b/nova/openstack/common/rpc/impl_zmq.py index dc5491381..6fd83e67e 100644 --- a/nova/openstack/common/rpc/impl_zmq.py +++ b/nova/openstack/common/rpc/impl_zmq.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import json import pprint +import socket import string import sys import types @@ -28,6 +28,7 @@ import greenlet from nova.openstack.common import cfg from nova.openstack.common.gettextutils import _ from nova.openstack.common import importutils +from nova.openstack.common import jsonutils from nova.openstack.common.rpc import common as rpc_common @@ -76,7 +77,7 @@ def _serialize(data): Error if a developer passes us bad data. """ try: - return str(json.dumps(data, ensure_ascii=True)) + return str(jsonutils.dumps(data, ensure_ascii=True)) except TypeError: LOG.error(_("JSON serialization failed.")) raise @@ -87,7 +88,7 @@ def _deserialize(data): Deserialization wrapper """ LOG.debug(_("Deserializing: %s"), data) - return json.loads(data) + return jsonutils.loads(data) class ZmqSocket(object): |