Open tas50 opened 4 months ago
Raising this, there are parse errors in valid YAML, eg:
$ cnquery shell ansible playbook.yml
→ no Mondoo configuration file provided, using defaults
x unable to create runtime for asset error="rpc error: code = Unknown desc = yaml: unmarshal errors:\n line 15: cannot unmarshal !!seq into map[string]interface {}" asset=
FTL could not find an asset that we can connect to
$ yamllint playbook.yml
playbook.yml
3:11 warning truthy value should be one of [false, true] (truthy)
9:8 warning missing starting space in comment (comments)
9:7 warning comment not indented like content (comments-indentation)
10:8 warning missing starting space in comment (comments)
23:81 error line too long (131 > 80 characters) (line-length)
45:81 error line too long (115 > 80 characters) (line-length)
50:81 error line too long (83 > 80 characters) (line-length)
94:81 error line too long (140 > 80 characters) (line-length)
Tested with https://github.com/mondoohq/private-runners/blob/main/playbook.yml
The offending YAML for my case is:
- registration_token: "{{ lookup('env','MONDOO_TOKEN') }}"
Describe the bug Today if you try to scan YAML that's not necessary a playbook the provider throws unmarshall errors. We should validate the code to some degree and throw a friendly error message if we can't parse the code.
Example where I scan defaults/main.yml from our ansible role: