[JUJU-3456] Fix returned error when yaml is invalid on diff-bundle #15497
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When dealing with invalid yaml in local bundle, the error was treated as if the file was not present, therefore continuing to treat the input as a charm bundle url.
This patch fixes the returned error if it's a NotValid error.
Checklist
Integration tests, with comments saying what you're testingdoc.go added or updated in changed packagesQA steps
Having an empty juju model and this test.yaml bundle:
then you should get this error:
$ juju diff-bundle test.yaml ERROR cannot unmarshal bundle contents: unmarshal document 0: yaml: line 12: could not find expected ':'
if you remove line 12 then:
$ juju diff-bundle test.yaml applications: ubuntu: missing: model machines: "0": missing: model
Bug reference
https://bugs.launchpad.net/juju/+bug/2015315