Merge ~chad.smith/cloud-init:cleanup/schema-annotate-invalid-yaml into cloud-init:master
Status: | Merged |
---|---|
Approved by: | Scott Moser |
Approved revision: | 142f14337d5583b69160cd66160218483b86fcbe |
Merge reported by: | Scott Moser |
Merged at revision: | 3b28bdc616f3e7f4d6b419629dc7b9efc3ae8d1e |
Proposed branch: | ~chad.smith/cloud-init:cleanup/schema-annotate-invalid-yaml |
Merge into: | cloud-init:master |
Diff against target: |
274 lines (+118/-27) 4 files modified
cloudinit/config/schema.py (+44/-16) cloudinit/util.py (+14/-2) tests/unittests/test_handler/test_schema.py (+33/-6) tests/unittests/test_util.py (+27/-3) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Scott Moser | Approve | ||
Server Team CI bot | continuous-integration | Approve | |
Review via email: mp+346415@code.launchpad.net |
Commit message
yaml_load/schema: Add invalid line and column nums to error message
Yaml tracebacks are generally hard to read for average users. Add a bit of
logic to util.yaml_load and schema validation to look for
YAMLError.
No longer log the full exceeption traceback from the yaml_load error,
instead just LOG.warning for the specific error and point to the offending
line and column where the problem exists.
Description of the change
to test:
cat > noheader <<EOF
#notcloud-
{}
EOF
cat > badparse <<EOF
#cloud-config
{}}
EOF
cat > badscan <<EOF
#cloud-config
asdf:
needindent
EOF
for badfile in noheader badparse badscan; do
python3 -m cloudinit.cmd.main devel schema --annotate --config $badfile
done
FAILED: Continuous integration, rev:51169e63748 bcea4be108a6211 2b0ea935ee04d9 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ 13/
https:/
Executed test runs:
SUCCESS: Checkout
FAILED: Unit & Style Tests
Click here to trigger a rebuild: /jenkins. ubuntu. com/server/ job/cloud- init-ci/ 13/rebuild
https:/