bolt icon indicating copy to clipboard operation
bolt copied to clipboard

Ability to lint/validate plans prior to executing

Open nmaludy opened this issue 5 years ago • 6 comments

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_task and run_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.

nmaludy avatar Mar 31 '20 01:03 nmaludy

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.

adreyer avatar Apr 01 '20 14:04 adreyer

We have a similar request over in a Discussion in the pdk repo: https://github.com/puppetlabs/pdk/discussions/1057

sanfrancrisko avatar May 04 '21 12:05 sanfrancrisko

Just to tag this has been an issue for some PE customers @Adam-Shambrook

davidsandilands avatar Apr 05 '22 14:04 davidsandilands

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.

github-actions[bot] avatar Jul 29 '22 01:07 github-actions[bot]

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.

jay7x avatar Jul 29 '22 11:07 jay7x

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.

github-actions[bot] avatar Sep 28 '22 00:09 github-actions[bot]

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.

github-actions[bot] avatar Oct 05 '22 00:10 github-actions[bot]