yamlinc
yamlinc copied to clipboard
[BUG] Yamlinc must fail when $include path was't found
Version: v0.0.65 Steps to reproduce:
- Create file main.yml
some_key: "some_value"
some_data:
$include: included_file_that_does_not_exists.yml
- Run
yamlinc main.yml && cat main.inc.yml
Output:
## --------------------
## DON'T EDIT THIS FILE
## --------------------
## Engine: [email protected]
## Source: main.yml
some_key: some_value
some_data: {}
Expected result: Yamlinc must exit with status 1 and print error message: "Included file included_file_that_does_not_exists.yml was't found"
v0.1.1 also exhibits this behavior. I agree that this should notify the user, but there may be use cases where not finding a file is the behavior the user would want. I suggest that it should warn the user that a file (or files) weren't found for inclusion, instead of erroring.
The other issue I see is that it's putting {}
in its place (indicating an empty map). Should this be an empty string (assuming it won't error and only warn)?
Thoughts?
Hi @svmk @justinnichols there is a news about this in version 0.1.5 we can use '--strict' option in commad-line
The strict mode stop if 'Problem' occur during runtime (e.g. Syntax error or missing files) To respect your chain use this:
$ yamlinc --strict main.yml && cat main.inc.yml
On the next day I work to found a solution for {}