-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement singularity-compose.yml override configuration feature (#48)
* implement deep_merge functionally * implement some changes suggested during code review * add tests for the config override feature * good old black formatting that I keep forgetting :) * add docs * adding support for singularity-compose check this will add jsonschema as an optional dependency to check the validity of a singularity-compose.yml file. We will eventually extend this to check (and preview) combined files. Signed-off-by: vsoch <vsoch@users.noreply.github.com> * implement deep_merge functionally * implement some changes suggested during code review * add tests for the config override feature * tweak check group so it takes into account multiple files instead * implement preview option * update changelog and add docs * Apply suggestions from code review Co-authored-by: Vanessasaurus <814322+vsoch@users.noreply.github.com> * move deep_merge stuff to a brand new module * black formatting * remove extra bullet point * implement code review changes * move config functions into proper module Signed-off-by: vsoch <vsoch@users.noreply.github.com> and moving validate.py into its own file so we do not always import * use bot.exit over print and sys.exit (which combines the two) Signed-off-by: vsoch <vsoch@users.noreply.github.com> Co-authored-by: vsoch <vsoch@users.noreply.github.com> Co-authored-by: Vanessasaurus <814322+vsoch@users.noreply.github.com>
- Loading branch information
1 parent
4c691eb
commit 55db827
Showing
16 changed files
with
665 additions
and
74 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
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
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
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,37 @@ | ||
""" | ||
Copyright (C) 2021 Vanessa Sochat. | ||
This Source Code Form is subject to the terms of the | ||
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed | ||
with this file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
""" | ||
|
||
from scompose.logger import bot | ||
from scompose.config import merge_config | ||
from scompose.config.validate import validate_config | ||
import yaml | ||
|
||
|
||
def main(args, parser, extra): | ||
""" | ||
Validate compose files for correctness. | ||
CLI Arguments | ||
========== | ||
--preview flag to show combined configs. | ||
""" | ||
|
||
# validate compose files | ||
for f in args.file: | ||
result = validate_config(f) | ||
if not result and not args.preview: | ||
bot.info("%s is valid." % f) | ||
elif result: | ||
bot.exit("%s is not valid." % f) | ||
|
||
if args.preview: | ||
# preview | ||
config = merge_config(args.file) | ||
print(yaml.dump(config, sort_keys=False)) |
Oops, something went wrong.