-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configvalidate.py script to allow config validation during deploy…
…ment
- Loading branch information
Leigh Gordon
committed
Jan 18, 2021
1 parent
03d1090
commit 70f5a19
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python | ||
|
||
"""Script to test the validity of pipeline configuration, | ||
""" | ||
import argparse | ||
import os | ||
from jsonschema.exceptions import ValidationError | ||
from aodncore.pipeline.configlib import load_pipeline_config, validate_pipeline_config | ||
|
||
|
||
def validate_config_file(pipeline_conf_file): | ||
try: | ||
print("validating pipeline config file '{path}'...".format(path=pipeline_conf_file)) | ||
pipeline_config = load_pipeline_config(pipeline_conf_file) | ||
validate_pipeline_config(pipeline_config) | ||
except ValidationError as e: | ||
print("VALIDATION FAILED{nl}{nl}{e}".format(e=str(e), nl=os.linesep)) | ||
return 1 | ||
else: | ||
print('VALIDATION SUCCEEDED') | ||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('path') | ||
args = parser.parse_args() | ||
|
||
exit(validate_config_file(args.path)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters