Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail better in ansible provider when provided non-ansible code #4186

Open
tas50 opened this issue Jun 4, 2024 · 0 comments
Open

Fail better in ansible provider when provided non-ansible code #4186

tas50 opened this issue Jun 4, 2024 · 0 comments

Comments

@tas50
Copy link
Member

tas50 commented Jun 4, 2024

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:

cnspec scan ansible main.yml
→ found a new version for 'ansible' provider installed=10.0.0 latest=11.0.0
→ successfully installed ansible provider path=/Users/tsmith/.config/mondoo/providers/ansible version=11.0.0
→ loaded configuration from /Users/tsmith/.config/mondoo/mondoo.yml using source default
→ using service account credentials
→ discover related assets for 1 asset(s)
x unable to create runtime for asset error="rpc error: code = Unknown desc = yaml: unmarshal errors:\n  line 7: cannot unmarshal !!map into play.Playbook" asset=
Asset:
-------

error: rpc error: code = Unknown desc = yaml: unmarshal errors:
  line 7: cannot unmarshal !!map into play.Playbook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant