ccloudvm icon indicating copy to clipboard operation
ccloudvm copied to clipboard

Debugging parse errors in workloads is complicated

Open markdryan opened this issue 7 years ago • 1 comments

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.

markdryan avatar Mar 06 '18 11:03 markdryan

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.

rbradford avatar Mar 06 '18 12:03 rbradford