Skip to content

Commit

Permalink
Switch all uses of json to oslo_serialization
Browse files Browse the repository at this point in the history
This commit migrates all the usage of the json library to use jsonutils
from oslo_serialization. On python 3 httplib2 returns a bytes type for
the response body however all the methods in the json library are
expecting str types. We could switch all the uses of json.loads to
encode the input prior to calling json.loads however oslo_serialization
has baked in all dual python version edge conditions around this into
a call compatible lib which is much cleaner.

Change-Id: Icee30fb74db128c77b2c0c27e68b5801bd138cd5
  • Loading branch information
mtreinish committed Jul 14, 2015
1 parent e083f64 commit 2190551
Show file tree
Hide file tree
Showing 62 changed files with 63 additions and 82 deletions.
2 changes: 1 addition & 1 deletion tempest/api/object_storage/test_object_slo.py
Expand Up @@ -13,8 +13,8 @@
# under the License.

import hashlib
import json

from oslo_serialization import jsonutils as json
from tempest_lib import exceptions as lib_exc

from tempest.api.object_storage import base
Expand Down
2 changes: 1 addition & 1 deletion tempest/cmd/cleanup.py
Expand Up @@ -51,10 +51,10 @@
Please run with **--help** to see full list of options.
"""
import argparse
import json
import sys

from oslo_log import log as logging
from oslo_serialization import jsonutils as json

from tempest import clients
from tempest.cmd import cleanup_service
Expand Down
2 changes: 1 addition & 1 deletion tempest/cmd/run_stress.py
Expand Up @@ -16,7 +16,6 @@

import argparse
import inspect
import json
import sys
try:
from unittest import loader
Expand All @@ -25,6 +24,7 @@
from unittest2 import loader

from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from testtools import testsuite

from tempest.stress import driver
Expand Down
2 changes: 1 addition & 1 deletion tempest/cmd/verify_tempest_config.py
Expand Up @@ -15,11 +15,11 @@
# under the License.

import argparse
import json
import os
import sys

import httplib2
from oslo_serialization import jsonutils as json
from six import moves
from six.moves.urllib import parse as urlparse

Expand Down
2 changes: 1 addition & 1 deletion tempest/common/glance_http.py
Expand Up @@ -17,14 +17,14 @@

import copy
import hashlib
import json
import posixpath
import re
import socket
import struct

import OpenSSL
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
import six
from six import moves
from six.moves import http_client as httplib
Expand Down
2 changes: 1 addition & 1 deletion tempest/scenario/utils.py
Expand Up @@ -13,11 +13,11 @@
# under the License.


import json
import re
import string
import unicodedata

from oslo_serialization import jsonutils as json
from tempest_lib.common.utils import misc
import testscenarios
import testtools
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/baremetal/base.py
Expand Up @@ -11,8 +11,8 @@
# under the License.

import functools
import json

from oslo_serialization import jsonutils as json
import six
from six.moves.urllib import parse as urllib

Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/agents_client.py
Expand Up @@ -12,8 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib

from tempest.api_schema.response.compute.v2_1 import agents as schema
Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/aggregates_client.py
Expand Up @@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from tempest_lib import exceptions as lib_exc

from tempest.api_schema.response.compute.v2_1 import aggregates as schema
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/availability_zone_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import availability_zone \
as schema
Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/baremetal_nodes_client.py
Expand Up @@ -12,8 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib

from tempest.api_schema.response.compute.v2_1 import baremetal_nodes \
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/certificates_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import certificates as schema
from tempest.common import service_client
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/extensions_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import extensions as schema
from tempest.common import service_client
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/fixed_ips_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import fixed_ips as schema
from tempest.common import service_client
Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/flavors_client.py
Expand Up @@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib

from tempest.api_schema.response.compute.v2_1 import flavors as schema
Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/floating_ips_client.py
Expand Up @@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/hosts_client.py
Expand Up @@ -12,8 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib

from tempest.api_schema.response.compute.v2_1 import hosts as schema
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/hypervisor_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import hypervisors as schema
from tempest.common import service_client
Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/images_client.py
Expand Up @@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

Expand Down
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import \
instance_usage_audit_logs as schema
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/interfaces_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import interfaces as schema
from tempest.api_schema.response.compute.v2_1 import servers as servers_schema
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/keypairs_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import keypairs as schema
from tempest.common import service_client
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/limits_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import limits as schema
from tempest.common import service_client
Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/migrations_client.py
Expand Up @@ -12,8 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib

from tempest.api_schema.response.compute.v2_1 import migrations as schema
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/networks_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.common import service_client

Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/quota_classes_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1\
import quota_classes as classes_schema
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/quotas_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import quotas as schema
from tempest.common import service_client
Expand Down
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import \
security_group_default_rule as schema
Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/security_groups_client.py
Expand Up @@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/servers_client.py
Expand Up @@ -14,9 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
import time

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/services_client.py
Expand Up @@ -14,8 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib

from tempest.api_schema.response.compute.v2_1 import services as schema
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/compute/json/tenant_networks_client.py
Expand Up @@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.api_schema.response.compute.v2_1 import tenant_networks as schema
from tempest.common import service_client
Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/tenant_usages_client.py
Expand Up @@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib

from tempest.api_schema.response.compute.v2_1 import tenant_usages as schema
Expand Down
3 changes: 1 addition & 2 deletions tempest/services/compute/json/volumes_extensions_client.py
Expand Up @@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

Expand Down
Expand Up @@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.common import service_client

Expand Down
2 changes: 1 addition & 1 deletion tempest/services/identity/v2/json/identity_client.py
Expand Up @@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json
from tempest_lib import exceptions as lib_exc

from tempest.common import service_client
Expand Down
2 changes: 1 addition & 1 deletion tempest/services/identity/v3/json/credentials_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.common import service_client

Expand Down
2 changes: 1 addition & 1 deletion tempest/services/identity/v3/json/endpoints_client.py
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json
from oslo_serialization import jsonutils as json

from tempest.common import service_client

Expand Down
3 changes: 1 addition & 2 deletions tempest/services/identity/v3/json/identity_client.py
Expand Up @@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import json

from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib

from tempest.common import service_client
Expand Down

0 comments on commit 2190551

Please sign in to comment.