From 518aa14b6445a1963e08d073e9a68b525116cef0 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Mon, 18 Nov 2024 22:32:36 +0100 Subject: [PATCH] Revert "fix: Skip permissions set and check for in-place" This reverts commit 53e1f6df6a2d809cc930568e29c9593b71d0942a. --- bundle/bundle_read_only.go | 4 ---- bundle/config/validate/folder_permissions.go | 4 ---- bundle/config/validate/folder_permissions_test.go | 3 --- bundle/permissions/workspace_root.go | 4 ---- bundle/permissions/workspace_root_test.go | 2 -- 5 files changed, 17 deletions(-) diff --git a/bundle/bundle_read_only.go b/bundle/bundle_read_only.go index 466b09034..ceab95c0b 100644 --- a/bundle/bundle_read_only.go +++ b/bundle/bundle_read_only.go @@ -32,10 +32,6 @@ func (r ReadOnlyBundle) SyncRoot() vfs.Path { return r.b.SyncRoot } -func (r ReadOnlyBundle) SyncRootPath() string { - return r.b.SyncRootPath -} - func (r ReadOnlyBundle) WorkspaceClient() *databricks.WorkspaceClient { return r.b.WorkspaceClient() } diff --git a/bundle/config/validate/folder_permissions.go b/bundle/config/validate/folder_permissions.go index 4cc2d9a01..505e82a1e 100644 --- a/bundle/config/validate/folder_permissions.go +++ b/bundle/config/validate/folder_permissions.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "path" - "strings" "github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle/libraries" @@ -31,9 +30,6 @@ func (f *folderPermissions) Apply(ctx context.Context, b bundle.ReadOnlyBundle) g, ctx := errgroup.WithContext(ctx) results := make([]diag.Diagnostics, len(bundlePaths)) for i, p := range bundlePaths { - if strings.HasPrefix(p, b.SyncRootPath()) { - continue - } g.Go(func() error { results[i] = checkFolderPermission(ctx, b, p) return nil diff --git a/bundle/config/validate/folder_permissions_test.go b/bundle/config/validate/folder_permissions_test.go index 92ff0a0b6..f609724ee 100644 --- a/bundle/config/validate/folder_permissions_test.go +++ b/bundle/config/validate/folder_permissions_test.go @@ -78,7 +78,6 @@ func TestFolderPermissionsInheritedWhenRootPathDoesNotExist(t *testing.T) { func TestValidateFolderPermissionsFailsOnMissingBundlePermission(t *testing.T) { b := &bundle.Bundle{ - SyncRootPath: t.TempDir(), Config: config.Root{ Workspace: config.Workspace{ RootPath: "/Workspace/Users/foo@bar.com", @@ -131,7 +130,6 @@ func TestValidateFolderPermissionsFailsOnMissingBundlePermission(t *testing.T) { func TestValidateFolderPermissionsFailsOnPermissionMismatch(t *testing.T) { b := &bundle.Bundle{ - SyncRootPath: t.TempDir(), Config: config.Root{ Workspace: config.Workspace{ RootPath: "/Workspace/Users/foo@bar.com", @@ -177,7 +175,6 @@ func TestValidateFolderPermissionsFailsOnPermissionMismatch(t *testing.T) { func TestValidateFolderPermissionsFailsOnNoRootFolder(t *testing.T) { b := &bundle.Bundle{ - SyncRootPath: t.TempDir(), Config: config.Root{ Workspace: config.Workspace{ RootPath: "/NotExisting", diff --git a/bundle/permissions/workspace_root.go b/bundle/permissions/workspace_root.go index 665be88ca..de4f3a7fe 100644 --- a/bundle/permissions/workspace_root.go +++ b/bundle/permissions/workspace_root.go @@ -3,7 +3,6 @@ package permissions import ( "context" "fmt" - "strings" "github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle/libraries" @@ -60,9 +59,6 @@ func giveAccessForWorkspaceRoot(ctx context.Context, b *bundle.Bundle) error { g, ctx := errgroup.WithContext(ctx) for _, p := range bundlePaths { - if strings.HasPrefix(p, b.SyncRootPath) { - continue - } g.Go(func() error { return setPermissions(ctx, w, p, permissions) }) diff --git a/bundle/permissions/workspace_root_test.go b/bundle/permissions/workspace_root_test.go index 7b9937609..c48704a63 100644 --- a/bundle/permissions/workspace_root_test.go +++ b/bundle/permissions/workspace_root_test.go @@ -19,7 +19,6 @@ import ( func TestApplyWorkspaceRootPermissions(t *testing.T) { b := &bundle.Bundle{ - SyncRootPath: t.TempDir(), Config: config.Root{ Workspace: config.Workspace{ RootPath: "/Users/foo@bar.com", @@ -80,7 +79,6 @@ func TestApplyWorkspaceRootPermissions(t *testing.T) { func TestApplyWorkspaceRootPermissionsForAllPaths(t *testing.T) { b := &bundle.Bundle{ - SyncRootPath: t.TempDir(), Config: config.Root{ Workspace: config.Workspace{ RootPath: "/Some/Root/Path",