Skip to content

Commit 6150709

Browse files
authored
direct: plan: when action=delete, do not fail deps on read errors (#4462)
## Why It's intended to work like that: if we plan to delete the resource we're reading it to see in case it already deleted. If we get error during read, we should delegate to resource's DoDelete() method - some of them are intentionally no-ops, so they will succeed. Fixes acceptance/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions
1 parent 86622c7 commit 6150709

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11

22
>>> errcode as-test-sp [CLI] bundle destroy --auto-approve
33
Warn: reading resources.jobs.foo.permissions id="/jobs/[NUMID]": [UUID] does not have Manage permissions on Job with ID: ElasticJobId([NUMID]). Please contact the owner or an administrator for access.
4-
Error: cannot plan resources.jobs.foo: dependency failed: resources.jobs.foo.permissions
4+
Warn: reading resources.jobs.foo id="[NUMID]": User [UUID] does not have View or Admin or Manage Run or Owner permissions on job [NUMID]
5+
The following resources will be deleted:
6+
delete resources.jobs.foo
57

6-
Error: planning failed
8+
All files and directories at the following location will be deleted: /Workspace/Users/[UUID]/.bundle/test-bundle-[UNIQUE_NAME]/default
79

8-
9-
Exit code: 1
10+
Warn: Ignoring permission error when deleting resources.jobs.foo id=[NUMID]: User [UUID] does not have Admin or Owner permissions on job [NUMID]
11+
Deleting files...
12+
Destroy complete!

bundle/direct/bundle_plan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (b *DeploymentBundle) CalculatePlan(ctx context.Context, client *databricks
180180
plan.RemoveEntry(resourceKey)
181181
} else {
182182
log.Warnf(ctx, "reading %s id=%q: %s", resourceKey, dbentry.ID, err)
183-
return false
183+
// This is not an error during deletion, so don't return false here
184184
}
185185
}
186186

0 commit comments

Comments
 (0)