|
20 | 20 | from jsonschema import ValidationError
|
21 | 21 |
|
22 | 22 | import util
|
23 |
| -from util import ask, log, err, indent, unindent |
| 23 | +from util import ask, log, warn, err, indent, unindent |
24 | 24 |
|
25 | 25 |
|
26 | 26 | class UserError(Exception):
|
@@ -720,10 +720,14 @@ def __init__(self, option_strings, dest, nargs=None, const=None, default=None, t
|
720 | 720 | super().__init__(option_strings, dest, nargs, const, default, type, choices, required, help, metavar)
|
721 | 721 |
|
722 | 722 | def __call__(self, parser, namespace, values, option_string=None):
|
723 |
| - if not hasattr(namespace, self.dest) or not getattr(namespace, self.dest): |
724 |
| - setattr(namespace, self.dest, Context()) |
725 |
| - context: Context = getattr(namespace, self.dest) |
726 |
| - context.add_file(values) |
| 723 | + if os.path.exists(values): |
| 724 | + if not hasattr(namespace, self.dest) or not getattr(namespace, self.dest): |
| 725 | + setattr(namespace, self.dest, Context()) |
| 726 | + context: Context = getattr(namespace, self.dest) |
| 727 | + context.add_file(values) |
| 728 | + else: |
| 729 | + warn(yellow( |
| 730 | + f"WARNING: context file '{values}' does not exist (manifest processing might result in errors).")) |
727 | 731 |
|
728 | 732 | # parse arguments
|
729 | 733 | argparser = argparse.ArgumentParser(description="Deployment automation tool.",
|
|
0 commit comments