Skip to content
Snippets Groups Projects
Verified Commit 49b11ff2 authored by Alexander Kreft's avatar Alexander Kreft
Browse files

MAINT: fix optional package

parent c8553d1e
No related branches found
No related tags found
2 merge requests!33MAINT: change arguments of create_user,!29Revert "Revert "Merge branch 'f-validate-config' into 'dev'""
Pipeline #14528 passed
......@@ -24,7 +24,11 @@
import os
import yaml
from jsonschema import validate
try:
optional_jsonschema = None
from jsonschema import validate as optional_jsonschema_validate
except ImportError:
pass
try:
# python2
......@@ -79,9 +83,10 @@ def config_to_yaml(config):
def validate_yaml_schema(valobj):
with open(os.path.join(os.path.dirname(__file__), "schema-pycaosdb-ini.yml")) as f:
schema = yaml.load(f, Loader=yaml.SafeLoader)
validate(instance=valobj, schema=schema["schema-pycaosdb-ini"])
if optional_jsonschema_validate:
with open(os.path.join(os.path.dirname(__file__), "schema-pycaosdb-ini.yml")) as f:
schema = yaml.load(f, Loader=yaml.SafeLoader)
optional_jsonschema_validate(instance=valobj, schema=schema["schema-pycaosdb-ini"])
def _read_config_files():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment