Merge "Update json module to jsonutils"

This commit is contained in:
Zuul 2019-02-27 03:21:08 +00:00 committed by Gerrit Code Review
commit 4db0f5b9a8
2 changed files with 5 additions and 4 deletions

View File

@ -21,13 +21,13 @@ import binascii
import eventlet import eventlet
import functools import functools
import inspect import inspect
import json
import mimetypes import mimetypes
from oslo_concurrency import lockutils from oslo_concurrency import lockutils
from oslo_concurrency import processutils from oslo_concurrency import processutils
from oslo_context import context as common_context from oslo_context import context as common_context
from oslo_log import log as logging from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import excutils from oslo_utils import excutils
from oslo_utils import strutils from oslo_utils import strutils
import pecan import pecan
@ -369,7 +369,7 @@ def check_capsule_template(tpl):
tpl_json = tpl tpl_json = tpl
if isinstance(tpl, six.string_types): if isinstance(tpl, six.string_types):
try: try:
tpl_json = json.loads(tpl) tpl_json = jsonutils.loads(tpl)
except Exception as e: except Exception as e:
raise exception.FailedParseStringToJson(e) raise exception.FailedParseStringToJson(e)

View File

@ -19,12 +19,13 @@ Create Date: 2018-06-20 11:21:38.077673
""" """
import json
import shlex import shlex
from alembic import op from alembic import op
import sqlalchemy as sa import sqlalchemy as sa
from oslo_serialization import jsonutils
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = '3e80bbfd8da7' revision = '3e80bbfd8da7'
@ -47,7 +48,7 @@ def upgrade():
for row in session.query(TABLE_MODEL): for row in session.query(TABLE_MODEL):
if row[1]: if row[1]:
command = shlex.split(row[1]) command = shlex.split(row[1])
command = json.dumps(command) command = jsonutils.dumps(command)
session.execute( session.execute(
TABLE_MODEL.update().values( TABLE_MODEL.update().values(
command=command).where( command=command).where(