Skip to content
This repository has been archived by the owner on Oct 17, 2022. It is now read-only.

Debugging parse errors in workloads is complicated #71

Open
markdryan opened this issue Mar 6, 2018 · 1 comment
Open

Debugging parse errors in workloads is complicated #71

markdryan opened this issue Mar 6, 2018 · 1 comment

Comments

@markdryan
Copy link
Contributor

If there's a parse error in a workload the create command fails with an error that looks something like this.

$ ccloudvm create --debug xenial
Error: Error applying template to user-data: Error parsing workload: Unable to unmarshal userdata: yaml: line 45: found unexpected end of stream

This information, including the line number, is useless as it doesn't indicate which workload is causing the problem (if you're using inheritance there may be more than one) and as the workload is pre-processed before handing it to the yaml parser, the line number 45 is meaningless.

The only way to really fix this is ccloudvm to return better error information including some sort of context along with the error. Something like

 - {{endTaskCheck .}}
'   <-- PARSE ERROR
{{range .Mounts}}

would be great if we could do it.

@rbradford
Copy link
Contributor

That's a good solution.

The line numbers have never correctly reflected the multiple document nature of the files. I did look into the yaml package in the past and sadly there is no way to extract the line number at fault in a programmatic form such that it could be made file relative vs document relative.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants