Merge "Drop simplejson usage"

This commit is contained in:
Zuul 2018-12-11 22:12:52 +00:00 committed by Gerrit Code Review
commit bf1a956bcc
5 changed files with 8 additions and 14 deletions

View File

@ -16,20 +16,18 @@
# under the License.
import copy
import json
import ddt
import json
import mock
from simplejson import scanner
from six.moves import http_client
from cinder import exception
from cinder import test
from cinder.tests.unit.volume.drivers.netapp.eseries import fakes as \
eseries_fake
from cinder.volume.drivers.netapp.eseries import exception as es_exception
from cinder.volume.drivers.netapp.eseries import client
from cinder.volume.drivers.netapp.eseries import exception as es_exception
from cinder.volume.drivers.netapp import utils as na_utils
@ -1146,7 +1144,7 @@ class NetAppEseriesClientDriverTestCase(test.TestCase):
def test_invoke_bad_content_type(self):
"""Tests the invoke behavior with a non-JSON response"""
fake_response = mock.Mock()
fake_response.json = mock.Mock(side_effect=scanner.JSONDecodeError(
fake_response.json = mock.Mock(side_effect=ValueError(
'', '{}', 1))
fake_response.status_code = http_client.FAILED_DEPENDENCY
fake_response.text = "Fake Response"

View File

@ -20,7 +20,6 @@ import eventlet
from oslo_log import log as logging
from oslo_utils import excutils
import requests
from simplejson import scanner
import six
from six.moves import http_client
import uuid
@ -599,8 +598,8 @@ class SCApi(object):
LOG.error('Error invalid json: %s', blob)
except TypeError as ex:
LOG.error('Error TypeError. %s', ex)
except scanner.JSONDecodeError as ex:
LOG.error('Error JSONDecodeError. %s', ex)
except ValueError as ex:
LOG.error('JSON decoding error. %s', ex)
# We are here so this went poorly. Log our blob.
LOG.debug('_get_json blob %s', blob)
return None
@ -618,8 +617,8 @@ class SCApi(object):
LOG.error('Invalid API object: %s', blob)
except TypeError as ex:
LOG.error('Error TypeError. %s', ex)
except scanner.JSONDecodeError as ex:
LOG.error('Error JSONDecodeError. %s', ex)
except ValueError as ex:
LOG.error('JSON decoding error. %s', ex)
LOG.debug('_get_id failed: blob %s', blob)
return None

View File

@ -28,7 +28,6 @@ import uuid
from oslo_log import log as logging
import requests
from simplejson import scanner
import six
from six.moves import urllib
@ -287,7 +286,7 @@ class RestClient(WebserviceClient):
res_dict = res.json() if res.text else None
# This should only occur if we expected JSON, but were sent
# something else
except scanner.JSONDecodeError:
except ValueError:
res_dict = None
if cinder_utils.TRACE_API:

View File

@ -130,7 +130,6 @@ rfc3986==1.1.0
Routes==2.3.1
rsa==3.4.2
rtslib-fb==2.1.65
simplejson==3.5.1
six==1.10.0
smmap2==2.0.3
snowballstemmer==1.2.1

View File

@ -50,7 +50,6 @@ retrying!=1.3.0,>=1.2.3 # Apache-2.0
Routes>=2.3.1 # MIT
taskflow>=2.16.0 # Apache-2.0
rtslib-fb>=2.1.65 # Apache-2.0
simplejson>=3.5.1 # MIT
six>=1.10.0 # MIT
SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
sqlalchemy-migrate>=0.11.0 # Apache-2.0