yamlinc icon indicating copy to clipboard operation
yamlinc copied to clipboard

[BUG] Yamlinc must fail when $include path was't found

Open svmk opened this issue 6 years ago • 2 comments

Version: v0.0.65 Steps to reproduce:

  1. Create file main.yml
some_key: "some_value"
some_data:
    $include: included_file_that_does_not_exists.yml
  1. 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"

svmk avatar Oct 05 '18 11:10 svmk

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?

justinnichols avatar Oct 05 '18 13:10 justinnichols

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 {}

francescobianco avatar Oct 09 '18 13:10 francescobianco