Issue with loading yaml files after requirements change

Several dependent requirements have changed underneath Browbeat changing how
loaded schema file is passed into pykwalify in which strings are treated as
unicode vs a string.  This causes pykwalify to throw up a stacktrace.  This
has pykwalify load the yaml schema file instead thus avoiding the issue.

Change-Id: Iabe2162298f272fd0f2aa5cf365b11ab1f0e8c98
This commit is contained in:
akrzos 2018-01-17 12:56:14 -05:00
parent cc70a27c54
commit e7f97d118b
1 changed files with 2 additions and 3 deletions

View File

@ -47,9 +47,8 @@ def _validate_yaml(schema, config):
:param schema: The schema to validate with (browbeat, perfkit, rally...)
:param config: Loaded yaml to validate
"""
with open("{}/{}.yml".format(conf_schema_path, schema), "r") as schema_file:
schema = yaml.safe_load(schema_file)
check = pykwalify_core.Core(source_data=config, schema_data=schema)
check = pykwalify_core.Core(
source_data=config, schema_files=["{}/{}.yml".format(conf_schema_path, schema)])
try:
check.validate(raise_exception=True)
except pykwalify_errors.SchemaError as e: