Skip to content

Commit 42faa7b

Browse files
committed
show all failed resources
1 parent 65bc5dd commit 42faa7b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

acceptance/bundle/lifecycle/prevent-destroy/out.direct-exp.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
>>> musterr [CLI] bundle destroy --auto-approve
33
Error: resource my_pipelines has lifecycle.prevent_destroy set, but the plan calls for this resource to be recreated or destroyed. To avoid this error, disable lifecycle.prevent_destroy for pipelines.my_pipelines
4+
resource my_schema has lifecycle.prevent_destroy set, but the plan calls for this resource to be recreated or destroyed. To avoid this error, disable lifecycle.prevent_destroy for schemas.my_schema
45

56

67
Exit code (musterr): 1
@@ -22,6 +23,7 @@ recreate schemas.my_schema
2223
>>> musterr [CLI] bundle deploy
2324
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/prevent-destroy/default/files...
2425
Error: resource my_pipelines has lifecycle.prevent_destroy set, but the plan calls for this resource to be recreated or destroyed. To avoid this error, disable lifecycle.prevent_destroy for pipelines.my_pipelines
26+
resource my_schema has lifecycle.prevent_destroy set, but the plan calls for this resource to be recreated or destroyed. To avoid this error, disable lifecycle.prevent_destroy for schemas.my_schema
2527

2628

2729
Exit code (musterr): 1

bundle/phases/plan.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package phases
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67

78
"github.com/databricks/cli/bundle"
@@ -54,6 +55,7 @@ func deployPrepare(ctx context.Context, b *bundle.Bundle) map[string][]libraries
5455
// If it does, it returns an error.
5556
func checkForPreventDestroy(b *bundle.Bundle, actions []deployplan.Action) error {
5657
root := b.Config.Value()
58+
var errs []error
5759
for _, action := range actions {
5860
if action.ActionType != deployplan.ActionTypeRecreate && action.ActionType != deployplan.ActionTypeDelete {
5961
continue
@@ -71,8 +73,9 @@ func checkForPreventDestroy(b *bundle.Bundle, actions []deployplan.Action) error
7173
return fmt.Errorf("internal error: prevent_destroy is not a boolean for %s.%s", action.Group, action.Key)
7274
}
7375
if preventDestroy {
74-
return fmt.Errorf("resource %s has lifecycle.prevent_destroy set, but the plan calls for this resource to be recreated or destroyed. To avoid this error, disable lifecycle.prevent_destroy for %s.%s", action.Key, action.Group, action.Key)
76+
errs = append(errs, fmt.Errorf("resource %s has lifecycle.prevent_destroy set, but the plan calls for this resource to be recreated or destroyed. To avoid this error, disable lifecycle.prevent_destroy for %s.%s", action.Key, action.Group, action.Key))
7577
}
7678
}
77-
return nil
79+
80+
return errors.Join(errs...)
7881
}

0 commit comments

Comments
 (0)