Add config validation for default_data
It is a little difficult to set up default_data.json for users, and we already have the corresponding schema in the code. JSON-Schema outputs useful error message when users misconfigures some items. So this patch makes the schema validation enabled for default_data. Change-Id: Id0efae913c202a30476d73a3821711c5250fcfee
This commit is contained in:
parent
7a94c9eeee
commit
cad73b5646
@ -6,6 +6,7 @@ pbr>=2.0.0 # Apache-2.0
|
||||
Babel>=2.3.4 # BSD
|
||||
Flask!=0.11,<1.0,>=0.10 # BSD
|
||||
iso8601>=0.1.11 # MIT
|
||||
jsonschema>=2.0.0,<3.0.0,!=2.5.0 # MIT
|
||||
oslo.config>=3.22.0 # Apache-2.0
|
||||
oslo.i18n>=2.1.0 # Apache-2.0
|
||||
oslo.log>=3.22.0 # Apache-2.0
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
import itertools
|
||||
|
||||
import jsonschema
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import psutil
|
||||
@ -32,6 +33,7 @@ from stackalytics.processor import mps
|
||||
from stackalytics.processor import rcs
|
||||
from stackalytics.processor import record_processor
|
||||
from stackalytics.processor import runtime_storage
|
||||
from stackalytics.processor import schema
|
||||
from stackalytics.processor import utils
|
||||
from stackalytics.processor import vcs
|
||||
from stackalytics.processor import zanata
|
||||
@ -316,6 +318,12 @@ def main():
|
||||
LOG.critical('Unable to load default data')
|
||||
return not 0
|
||||
|
||||
try:
|
||||
jsonschema.validate(default_data, schema.default_data)
|
||||
except jsonschema.ValidationError as e:
|
||||
LOG.critical('The default data is invalid: %s' % e)
|
||||
return not 0
|
||||
|
||||
default_data_processor.process(runtime_storage_inst,
|
||||
default_data,
|
||||
CONF.driverlog_data_uri)
|
||||
|
@ -6,7 +6,6 @@
|
||||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
coverage>=4.0 # Apache-2.0
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
jsonschema!=2.5.0,<3.0.0,>=2.0.0 # MIT
|
||||
mock>=2.0 # BSD
|
||||
python-subunit>=0.0.18 # Apache-2.0/BSD
|
||||
sphinx>=1.5.1 # BSD
|
||||
|
Loading…
Reference in New Issue
Block a user