summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/__init__.py11
-rw-r--r--nova/api/openstack/wsgi.py8
2 files changed, 10 insertions, 9 deletions
diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py
index ebcdc6aed..33a5c4af4 100644
--- a/nova/api/ec2/__init__.py
+++ b/nova/api/ec2/__init__.py
@@ -38,6 +38,7 @@ from nova import flags
from nova import log as logging
from nova.openstack.common import cfg
from nova.openstack.common import importutils
+from nova.openstack.common import jsonutils
from nova import utils
from nova import wsgi
@@ -226,7 +227,7 @@ class EC2Token(wsgi.Middleware):
'path': req.path,
'params': auth_params,
}}}
- creds_json = utils.dumps(creds)
+ creds_json = jsonutils.dumps(creds)
headers = {'Content-Type': 'application/json'}
# Disable "has no x member" pylint error
@@ -245,7 +246,7 @@ class EC2Token(wsgi.Middleware):
# having keystone return token, tenant,
# user, and roles from this call.
- result = utils.loads(response)
+ result = jsonutils.loads(response)
try:
token_id = result['access']['token']['id']
except (AttributeError, KeyError), e:
@@ -289,7 +290,7 @@ class EC2KeystoneAuth(wsgi.Middleware):
creds = {'ec2Credentials': cred_dict}
else:
creds = {'auth': {'OS-KSEC2:ec2Credentials': cred_dict}}
- creds_json = utils.dumps(creds)
+ creds_json = jsonutils.dumps(creds)
headers = {'Content-Type': 'application/json'}
o = urlparse.urlparse(FLAGS.keystone_ec2_url)
@@ -306,7 +307,7 @@ class EC2KeystoneAuth(wsgi.Middleware):
else:
msg = _("Failure communicating with keystone")
return ec2_error(req, request_id, "Unauthorized", msg)
- result = utils.loads(data)
+ result = jsonutils.loads(data)
conn.close()
try:
@@ -645,7 +646,7 @@ class Executor(wsgi.Application):
env.pop(k)
LOG.exception(_('Unexpected error raised: %s'), unicode(ex))
- LOG.error(_('Environment: %s') % utils.dumps(env))
+ LOG.error(_('Environment: %s') % jsonutils.dumps(env))
return ec2_error(req, request_id, 'UnknownError',
_('An unknown error has occurred. '
'Please try your request again.'))
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py
index f65425246..04c87c21a 100644
--- a/nova/api/openstack/wsgi.py
+++ b/nova/api/openstack/wsgi.py
@@ -26,7 +26,7 @@ import webob
from nova import exception
from nova import log as logging
-from nova import utils
+from nova.openstack.common import jsonutils
from nova import wsgi
@@ -130,7 +130,7 @@ class JSONDeserializer(TextDeserializer):
def _from_json(self, datastring):
try:
- return utils.loads(datastring)
+ return jsonutils.loads(datastring)
except ValueError:
msg = _("cannot understand JSON")
raise exception.MalformedRequestBody(reason=msg)
@@ -242,7 +242,7 @@ class JSONDictSerializer(DictSerializer):
"""Default JSON request body serialization"""
def default(self, data):
- return utils.dumps(data)
+ return jsonutils.dumps(data)
class XMLDictSerializer(DictSerializer):
@@ -533,7 +533,7 @@ def action_peek_json(body):
"""Determine action to invoke."""
try:
- decoded = utils.loads(body)
+ decoded = jsonutils.loads(body)
except ValueError:
msg = _("cannot understand JSON")
raise exception.MalformedRequestBody(reason=msg)