json module replaced with jsonutils
Now for operations with JSON data jsonutils module from oslo.serialization package is used. Depends on patch [1] to fuel-main. [1]: https://review.openstack.org/#/c/143639/ Change-Id: If872d46fc23eb71860f3e6b8508eef7ce7b4f223 Closes-Bug: #1404856
This commit is contained in:
parent
b9a090c716
commit
1c8ed01da9
|
@ -13,8 +13,8 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
|
from oslo.serialization import jsonutils
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
import fuel_health.common.ssh
|
import fuel_health.common.ssh
|
||||||
|
@ -110,8 +110,8 @@ class GlanceTest(fuel_health.nmanager.NovaNetworkScenarioTest):
|
||||||
if client == self.glance_client_v1:
|
if client == self.glance_client_v1:
|
||||||
for group in object.properties:
|
for group in object.properties:
|
||||||
if group == group_props:
|
if group == group_props:
|
||||||
for i in json.loads(object.properties[group]):
|
for i in jsonutils.loads(object.properties[group]):
|
||||||
k = json.loads(object.properties[group])[prop]
|
k = jsonutils.loads(object.properties[group])[prop]
|
||||||
if i == prop and k == unicode(value_prop):
|
if i == prop and k == unicode(value_prop):
|
||||||
return 'OK'
|
return 'OK'
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -13,11 +13,12 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
from oslo.serialization import jsonutils
|
||||||
|
|
||||||
import muranoclient.common.exceptions as exceptions
|
import muranoclient.common.exceptions as exceptions
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ class MuranoTest(fuel_health.nmanager.PlatformServicesBaseClass):
|
||||||
|
|
||||||
for image in self.compute_client.images.list():
|
for image in self.compute_client.images.list():
|
||||||
if tag in image.metadata:
|
if tag in image.metadata:
|
||||||
metadata = json.loads(image.metadata[tag])
|
metadata = jsonutils.loads(image.metadata[tag])
|
||||||
if image_type == metadata['type']:
|
if image_type == metadata['type']:
|
||||||
return image
|
return image
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ class MuranoTest(fuel_health.nmanager.PlatformServicesBaseClass):
|
||||||
|
|
||||||
post_body = {'name': name}
|
post_body = {'name': name}
|
||||||
resp = requests.post(self.endpoint + 'environments',
|
resp = requests.post(self.endpoint + 'environments',
|
||||||
data=json.dumps(post_body),
|
data=jsonutils.dumps(post_body),
|
||||||
headers=self.headers)
|
headers=self.headers)
|
||||||
return resp.json()
|
return resp.json()
|
||||||
|
|
||||||
|
@ -215,7 +216,7 @@ class MuranoTest(fuel_health.nmanager.PlatformServicesBaseClass):
|
||||||
headers.update({'x-configuration-session': session_id})
|
headers.update({'x-configuration-session': session_id})
|
||||||
endpoint = '{0}environments/{1}/services'.format(self.endpoint,
|
endpoint = '{0}environments/{1}/services'.format(self.endpoint,
|
||||||
environment_id)
|
environment_id)
|
||||||
return requests.post(endpoint, data=json.dumps(json_data),
|
return requests.post(endpoint, data=jsonutils.dumps(json_data),
|
||||||
headers=headers).json()
|
headers=headers).json()
|
||||||
|
|
||||||
def list_services(self, environment_id, session_id=None):
|
def list_services(self, environment_id, session_id=None):
|
||||||
|
|
|
@ -12,19 +12,19 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from distutils import version
|
||||||
import itertools
|
import itertools
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from distutils import version
|
|
||||||
|
|
||||||
from nose import case
|
from nose import case
|
||||||
from nose.suite import ContextSuite
|
from nose.suite import ContextSuite
|
||||||
|
|
||||||
|
from oslo.serialization import jsonutils
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ def parse_json_file(file_path):
|
||||||
commands_path = os.path.join(
|
commands_path = os.path.join(
|
||||||
current_directory, file_path)
|
current_directory, file_path)
|
||||||
with open(commands_path, 'r') as f:
|
with open(commands_path, 'r') as f:
|
||||||
return json.load(f)
|
return jsonutils.load(f)
|
||||||
|
|
||||||
|
|
||||||
def get_exc_message(exception_value):
|
def get_exc_message(exception_value):
|
||||||
|
|
|
@ -12,23 +12,23 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from sqlalchemy.types import TypeDecorator, VARCHAR
|
from sqlalchemy.types import TypeDecorator, VARCHAR
|
||||||
|
|
||||||
|
from oslo.serialization import jsonutils
|
||||||
|
|
||||||
|
|
||||||
class JsonField(TypeDecorator):
|
class JsonField(TypeDecorator):
|
||||||
impl = VARCHAR
|
impl = VARCHAR
|
||||||
|
|
||||||
def process_bind_param(self, value, dialect):
|
def process_bind_param(self, value, dialect):
|
||||||
if value is not None:
|
if value is not None:
|
||||||
value = json.dumps(value)
|
value = jsonutils.dumps(value)
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def process_result_value(self, value, dialect):
|
def process_result_value(self, value, dialect):
|
||||||
if value is not None:
|
if value is not None:
|
||||||
value = json.loads(value)
|
value = jsonutils.loads(value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.serialization import jsonutils
|
||||||
from pecan import abort
|
from pecan import abort
|
||||||
from pecan import expose
|
from pecan import expose
|
||||||
from pecan import request
|
from pecan import request
|
||||||
|
@ -123,7 +123,7 @@ class TestrunsController(BaseRestController):
|
||||||
|
|
||||||
@expose('json')
|
@expose('json')
|
||||||
def post(self):
|
def post(self):
|
||||||
test_runs = json.loads(request.body)
|
test_runs = jsonutils.loads(request.body)
|
||||||
if 'objects' in test_runs:
|
if 'objects' in test_runs:
|
||||||
test_runs = test_runs['objects']
|
test_runs = test_runs['objects']
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ class TestrunsController(BaseRestController):
|
||||||
|
|
||||||
@expose('json')
|
@expose('json')
|
||||||
def put(self):
|
def put(self):
|
||||||
test_runs = json.loads(request.body)
|
test_runs = jsonutils.loads(request.body)
|
||||||
if 'objects' in test_runs:
|
if 'objects' in test_runs:
|
||||||
test_runs = test_runs['objects']
|
test_runs = test_runs['objects']
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,11 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
|
||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from oslo.serialization import jsonutils
|
||||||
|
|
||||||
|
|
||||||
class TestingAdapterClient(object):
|
class TestingAdapterClient(object):
|
||||||
def __init__(self, url):
|
def __init__(self, url):
|
||||||
|
@ -38,7 +39,7 @@ class TestingAdapterClient(object):
|
||||||
else:
|
else:
|
||||||
data_el['ostf_os_access_creds'] = ostf_os_access_creds
|
data_el['ostf_os_access_creds'] = ostf_os_access_creds
|
||||||
|
|
||||||
data = json.dumps({'objects': data})
|
data = jsonutils.dumps({'objects': data})
|
||||||
|
|
||||||
r = requests.request(
|
r = requests.request(
|
||||||
method,
|
method,
|
||||||
|
|
|
@ -21,6 +21,7 @@ gevent==0.13.8
|
||||||
importlib
|
importlib
|
||||||
keystonemiddleware>=1.2.0
|
keystonemiddleware>=1.2.0
|
||||||
kombu
|
kombu
|
||||||
|
oslo.serialization>=1.0.0
|
||||||
pecan>=0.3.0,<0.6.0
|
pecan>=0.3.0,<0.6.0
|
||||||
psycopg2>=2.5.1
|
psycopg2>=2.5.1
|
||||||
stevedore>=0.10
|
stevedore>=0.10
|
||||||
|
|
Loading…
Reference in New Issue