diff --git a/ceilometer/publisher/gnocchi.py b/ceilometer/publisher/gnocchi.py index 38bb088dde..ae19309901 100644 --- a/ceilometer/publisher/gnocchi.py +++ b/ceilometer/publisher/gnocchi.py @@ -15,6 +15,7 @@ from collections import defaultdict import hashlib import itertools +import json import operator import pkg_resources import threading @@ -28,7 +29,6 @@ from oslo_utils import timeutils import six import six.moves.urllib.parse as urlparse from stevedore import extension -import ujson from ceilometer import declarative from ceilometer import gnocchi_client @@ -502,7 +502,7 @@ class GnocchiPublisher(publisher.ConfigPublisherBase): def _search_resource(self, resource_type, query): try: return self._gnocchi.resource.search( - resource_type, ujson.loads(query)) + resource_type, json.loads(query)) except Exception: LOG.error("Fail to search resource type %{resource_type}s " "with '%{query}s'", diff --git a/ceilometer/publisher/http.py b/ceilometer/publisher/http.py index 3ae93fa52a..e57370e319 100644 --- a/ceilometer/publisher/http.py +++ b/ceilometer/publisher/http.py @@ -13,12 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. +import json + from oslo_log import log from oslo_utils import strutils import requests from requests import adapters from six.moves.urllib import parse as urlparse -import ujson from ceilometer import publisher @@ -154,7 +155,7 @@ class HttpPublisher(publisher.ConfigPublisherBase): if not data: LOG.debug('Data set is empty!') return - data = ujson.dumps(data) + data = json.dumps(data) LOG.trace('Message: %s', data) try: res = self.session.post(self.target, data=data, diff --git a/ceilometer/tests/tempest/aodh/service/client.py b/ceilometer/tests/tempest/aodh/service/client.py index 39d2cf8914..1043a05b1d 100644 --- a/ceilometer/tests/tempest/aodh/service/client.py +++ b/ceilometer/tests/tempest/aodh/service/client.py @@ -13,11 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. +import json + from six.moves.urllib import parse as urllib from tempest import config from tempest.lib.common import rest_client from tempest import manager -import ujson CONF = config.CONF @@ -28,10 +29,10 @@ class AlarmingClient(rest_client.RestClient): uri_prefix = "v2" def deserialize(self, body): - return ujson.loads(body.replace("\n", "")) + return json.loads(body.replace("\n", "")) def serialize(self, body): - return ujson.dumps(body) + return json.dumps(body) def list_alarms(self, query=None): uri = '%s/alarms' % self.uri_prefix diff --git a/ceilometer/tests/unit/publisher/test_http.py b/ceilometer/tests/unit/publisher/test_http.py index 9226644cfb..a5a53067d3 100644 --- a/ceilometer/tests/unit/publisher/test_http.py +++ b/ceilometer/tests/unit/publisher/test_http.py @@ -260,5 +260,5 @@ class TestHttpPublisher(base.BaseTestCase): with mock.patch.object(requests.Session, 'post') as post: publisher.publish_events(self.event_data) self.assertEqual( - '[{"some":"aa"},{"some":"aa"},{"some":"aa"}]', + '[{"some": "aa"}, {"some": "aa"}, {"some": "aa"}]', post.call_args[1]['data']) diff --git a/ceilometer/tests/unit/publisher/test_utils.py b/ceilometer/tests/unit/publisher/test_utils.py index ca9ee8ab2a..a882b964b8 100644 --- a/ceilometer/tests/unit/publisher/test_utils.py +++ b/ceilometer/tests/unit/publisher/test_utils.py @@ -14,8 +14,9 @@ # under the License. """Tests for ceilometer/publisher/utils.py """ +import json + from oslotest import base -import ujson from ceilometer.publisher import utils @@ -104,7 +105,7 @@ class TestSignature(base.BaseTestCase): data['message_signature'] = utils.compute_signature( data, 'not-so-secret') - jsondata = ujson.loads(ujson.dumps(data)) + jsondata = json.loads(json.dumps(data)) self.assertTrue(utils.verify_signature(jsondata, 'not-so-secret')) def test_verify_unicode_symbols(self): @@ -114,7 +115,7 @@ class TestSignature(base.BaseTestCase): data['message_signature'] = utils.compute_signature( data, 'not-so-secret') - jsondata = ujson.loads(ujson.dumps(data)) + jsondata = json.loads(json.dumps(data)) self.assertTrue(utils.verify_signature(jsondata, 'not-so-secret')) def test_verify_no_secret(self): diff --git a/requirements.txt b/requirements.txt index b978ac8a37..9282f42459 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,6 @@ oslo.reports>=0.6.0 # Apache-2.0 oslo.rootwrap>=2.0.0 # Apache-2.0 pbr>=1.6 # Apache-2.0 oslo.messaging>=5.12.0 # Apache-2.0 -ujson oslo.utils>=3.5.0 # Apache-2.0 pysnmp<5.0.0,>=4.2.3 # BSD python-glanceclient>=2.0.0 # Apache-2.0