Ability to lint/validate plans prior to executing
Use Case
As a bolt module developer i'm human and sometimes make mistakes. Often i mistype the name of a task or plan when passed into run_task or run_plan. It would be great if we could perform an initial sanity check on the plan structure prior to execution so that it can fail early, instead of waiting for potentially a long time then only to find the error in the middle of an execution.
Describe the Solution You Would Like
Some ideas that would be great to lint/validate:
- Task and plan names (passed into
run_taskandrun_plan) - Task and plan parameter names and types (if possible, obviously if the user doesn't specify a type, we can't validate it).
- Basic Puppet syntax, currently syntax errors fail when they're encountered instead of upfront.
Obviously there are limitations on this, for example if the user passes a variable as the task/plan name, we can't validate it exists. I think there are a lot of positives though and could potentially catch a good number of errors.
In regular Puppet land i believe we want to emulate puppet parser validate , but for Bolt. Maybe the CLI syntax would look something like:
bolt plan validate mymodule::myplan
Describe Alternatives You've Considered
I think the other alternative would be spec testing, some way to exercise the "bones" of a plan before running.
For people writing plans that don't process the results of actions simply allowing all actions and providing simple input is probably the best way to provide this level of testing.
We have a similar request over in a Discussion in the pdk repo: https://github.com/puppetlabs/pdk/discussions/1057
Just to tag this has been an issue for some PE customers @Adam-Shambrook
This issue has not had activity for 60 days and will be marked as stale. If this issue continues to have no activity for 7 days, it will be closed.
I did this PR into PDK repo while ago but then found signing CLA can be problematic on my previous job. But now I signed it already so we can proceed with it there.
This issue has not had activity for 60 days and will be marked as stale. If this issue continues to have no activity for 7 days, it will be closed.
This issue is stale and has been closed. If you believe this is in error, or would like the Bolt team to reconsider it, please reopen the issue.