Use simplejson to load json file
The simplejson extends json library. It provides sufficient information about JSON syntax errors, which often occurs during instackenv.json file creation. Change-Id: Ied1c080678af728820e02b7b99c51762b49b1449 Closes-Bug: #1693442 Depends on external: https://review.rdoproject.org/r/#/c/7872/
This commit is contained in:
parent
9c9521f31b
commit
b60d221fe1
@ -11,6 +11,7 @@ python-heatclient>=1.6.1 # Apache-2.0
|
||||
python-ironicclient>=1.14.0 # Apache-2.0
|
||||
python-mistralclient>=3.1.0 # Apache-2.0
|
||||
python-openstackclient!=3.10.0,>=3.3.0 # Apache-2.0
|
||||
simplejson>=2.2.0 # MIT
|
||||
six>=1.9.0 # MIT
|
||||
osc-lib>=1.7.0 # Apache-2.0
|
||||
websocket-client>=0.32.0 # LGPLv2+
|
||||
|
@ -17,10 +17,10 @@ from __future__ import print_function
|
||||
import csv
|
||||
import datetime
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import os.path
|
||||
import simplejson
|
||||
import six
|
||||
import socket
|
||||
import subprocess
|
||||
@ -647,7 +647,7 @@ def _csv_to_nodes_dict(nodes_csv):
|
||||
|
||||
def parse_env_file(env_file, file_type=None):
|
||||
if file_type == 'json' or env_file.name.endswith('.json'):
|
||||
nodes_config = json.load(env_file)
|
||||
nodes_config = simplejson.load(env_file)
|
||||
elif file_type == 'csv' or env_file.name.endswith('.csv'):
|
||||
nodes_config = _csv_to_nodes_dict(env_file)
|
||||
elif env_file.name.endswith('.yaml'):
|
||||
|
@ -16,8 +16,8 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import logging
|
||||
import simplejson
|
||||
import time
|
||||
import uuid
|
||||
|
||||
@ -50,7 +50,7 @@ class ValidateInstackEnv(command.Command):
|
||||
self.error_count = 0
|
||||
|
||||
with open(parsed_args.instackenv, 'r') as net_file:
|
||||
env_data = json.load(net_file)
|
||||
env_data = simplejson.load(net_file)
|
||||
|
||||
maclist = []
|
||||
baremetal_ips = []
|
||||
@ -356,7 +356,7 @@ class ConfigureReadyState(command.Command):
|
||||
self.bm_client = self.app.client_manager.baremetal
|
||||
|
||||
with open(parsed_args.file, 'r') as fp:
|
||||
self.ready_state_config = json.load(fp)
|
||||
self.ready_state_config = simplejson.load(fp)
|
||||
|
||||
drac_nodes = []
|
||||
for node in self.bm_client.node.list(detail=True):
|
||||
|
@ -11,9 +11,9 @@
|
||||
# under the License.
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import simplejson
|
||||
import yaml
|
||||
|
||||
from osc_lib.command import command
|
||||
@ -44,7 +44,7 @@ class SetParameters(command.Command):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
|
||||
if parsed_args.file_in.name.endswith('.json'):
|
||||
params = json.load(parsed_args.file_in)
|
||||
params = simplejson.load(parsed_args.file_in)
|
||||
elif parsed_args.file_in.name.endswith('.yaml'):
|
||||
params = yaml.safe_load(parsed_args.file_in)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user