Merge "Drop use of simplejson, switching to json"

This commit is contained in:
Jenkins 2014-07-24 18:22:15 +00:00 committed by Gerrit Code Review
commit 0eddbb0fb2
4 changed files with 8 additions and 9 deletions

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
import argparse import argparse
import simplejson import json
import textwrap import textwrap
from os_cloud_config import nodes from os_cloud_config import nodes
@ -52,7 +52,7 @@ def main():
try: try:
with open(args.nodes, 'r') as node_file: with open(args.nodes, 'r') as node_file:
nodes_list = simplejson.load(node_file) nodes_list = json.load(node_file)
utils._ensure_environment() utils._ensure_environment()
# TODO(StevenK): Filter out registered nodes. # TODO(StevenK): Filter out registered nodes.

View File

@ -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
import os import os
from os import path from os import path
import simplejson
import stat import stat
from OpenSSL import crypto from OpenSSL import crypto
@ -152,7 +152,7 @@ def generate_certs_into_json(jsonfile, seed):
""" """
if os.path.isfile(jsonfile): if os.path.isfile(jsonfile):
with open(jsonfile) as json_fd: with open(jsonfile) as json_fd:
all_data = simplejson.load(json_fd) all_data = json.load(json_fd)
else: else:
all_data = {} all_data = {}
@ -181,7 +181,7 @@ def generate_certs_into_json(jsonfile, seed):
signing_key_name: signing_key_pem, signing_key_name: signing_key_pem,
signing_cert_name: signing_cert_pem}) signing_cert_name: signing_cert_pem})
with open(jsonfile, 'w') as json_fd: with open(jsonfile, 'w') as json_fd:
simplejson.dump(all_data, json_fd, sort_keys=True) json.dump(all_data, json_fd, sort_keys=True)
LOG.debug("Wrote key/certs into '%s'.", path.abspath(jsonfile)) LOG.debug("Wrote key/certs into '%s'.", path.abspath(jsonfile))
else: else:
LOG.info("Key/certs are already present in '%s', skipping.", LOG.info("Key/certs are already present in '%s', skipping.",

View File

@ -103,7 +103,7 @@ class KeystonePKITest(base.TestCase):
@mock.patch('os_cloud_config.keystone_pki.create_ca_pair') @mock.patch('os_cloud_config.keystone_pki.create_ca_pair')
@mock.patch('os_cloud_config.keystone_pki.create_signing_pair') @mock.patch('os_cloud_config.keystone_pki.create_signing_pair')
@mock.patch('os_cloud_config.keystone_pki.open', create=True) @mock.patch('os_cloud_config.keystone_pki.open', create=True)
@mock.patch('os_cloud_config.keystone_pki.simplejson.dump') @mock.patch('os_cloud_config.keystone_pki.json.dump')
def test_generate_certs_into_json( def test_generate_certs_into_json(
self, mock_json, open_, create_signing, create_ca, isfile): self, mock_json, open_, create_signing, create_ca, isfile):
create_ca.return_value = ('mock_ca_key', 'mock_ca_cert') create_ca.return_value = ('mock_ca_key', 'mock_ca_cert')
@ -122,8 +122,8 @@ class KeystonePKITest(base.TestCase):
@mock.patch('os_cloud_config.keystone_pki.create_ca_pair') @mock.patch('os_cloud_config.keystone_pki.create_ca_pair')
@mock.patch('os_cloud_config.keystone_pki.create_signing_pair') @mock.patch('os_cloud_config.keystone_pki.create_signing_pair')
@mock.patch('os_cloud_config.keystone_pki.open', create=True) @mock.patch('os_cloud_config.keystone_pki.open', create=True)
@mock.patch('os_cloud_config.keystone_pki.simplejson.load') @mock.patch('os_cloud_config.keystone_pki.json.load')
@mock.patch('os_cloud_config.keystone_pki.simplejson.dump') @mock.patch('os_cloud_config.keystone_pki.json.dump')
def test_generate_certs_into_json_with_existing_certs( def test_generate_certs_into_json_with_existing_certs(
self, mock_json_dump, mock_json_load, open_, create_signing, self, mock_json_dump, mock_json_load, open_, create_signing,
create_ca, isfile): create_ca, isfile):

View File

@ -7,4 +7,3 @@ python-keystoneclient>=0.9.0
python-novaclient>=2.17.0 python-novaclient>=2.17.0
oslo.config>=1.2.1 oslo.config>=1.2.1
pyOpenSSL>=0.11 pyOpenSSL>=0.11
simplejson>=2.0.9