mondoohq / cnquery

open source, cloud-native, graph-based asset inventory

Home Page:https://cnquery.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail when an invalid `discover` flag is provided

tas50 opened this issue · comments

Describe the bug
Right now if someone puts in a bogus or typo'd discover flag the scan will silently fail.

cnspec scan azure --discover resources --config ~/Downloads/edge-default.json --verbose
DBG using provider azure with connector azure
DBG Started a new runtime (1 total)
DBG no need to update provider last-refresh=33.083217s provider=azure
DBG Log level set to debug
DBG Started a new runtime (2 total)
→ loaded configuration from /Users/tsmith/Downloads/edge-default.json using source --config
→ using service account credentials
DBG Started a new runtime (3 total)
DBG initialize client authentication issuer=mondoo/ams kid=//agents.api.mondoo.app/spaces/pedantic-shockley-1234/serviceaccounts/1234
→ discover related assets for 1 asset(s)
DBG Started a new runtime (4 total)
DBG using default azure token chain resolver
DBG initialize client authentication issuer=mondoo/ams kid=//agents.api.mondoo.app/spaces/pedantic-shockley-1234/serviceaccounts/1234
DBG shutting down unused provider azure

We should validate the discovery flags and fail with a useful message if they are not correct.