do: verify the action exists before running

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2022-03-08 18:34:47 -08:00
parent 116e25ce20
commit 9f2d56f3c4
3 changed files with 30 additions and 19 deletions

View File

@@ -38,6 +38,10 @@ func NewRunner(pctx *plancontext.Context, target cue.Path, s solver.Solver) *Run
}
func (r *Runner) Run(ctx context.Context, src *compiler.Value) error {
if !src.LookupPath(r.target).Exists() {
return fmt.Errorf("%s not found", r.target.String())
}
if err := r.update(cue.MakePath(), src); err != nil {
return err
}