Skip to content

Commit 79b4027

Browse files
Restore permission error handling in workspace filesystem lock
The old lock.Acquire mutator checked for fs.ErrPermission and fs.ErrNotExist and reported possible permission denied errors. This was lost when refactoring to the DeploymentLock interface. Co-authored-by: Isaac
1 parent e85a6e0 commit 79b4027

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

bundle/deploy/lock/workspace_filesystem.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ package lock
22

33
import (
44
"context"
5+
"errors"
6+
"io/fs"
57

68
"github.com/databricks/cli/bundle"
9+
"github.com/databricks/cli/bundle/permissions"
710
"github.com/databricks/cli/libs/locker"
811
"github.com/databricks/cli/libs/log"
912
)
@@ -39,6 +42,12 @@ func (l *workspaceFilesystemLock) Acquire(ctx context.Context) error {
3942
err = lk.Lock(ctx, force)
4043
if err != nil {
4144
log.Errorf(ctx, "Failed to acquire deployment lock: %v", err)
45+
46+
if errors.Is(err, fs.ErrPermission) || errors.Is(err, fs.ErrNotExist) {
47+
diags := permissions.ReportPossiblePermissionDenied(ctx, b, b.Config.Workspace.StatePath)
48+
return diags.Error()
49+
}
50+
4251
return err
4352
}
4453

0 commit comments

Comments
 (0)