mirror of https://github.com/databricks/cli.git
fix: Skip permissions set and check for in-place
This commit is contained in:
parent
e65b50cf3c
commit
53e1f6df6a
|
@ -32,6 +32,10 @@ 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()
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/databricks/cli/bundle"
|
||||
"github.com/databricks/cli/bundle/libraries"
|
||||
|
@ -30,6 +31,9 @@ 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
|
||||
|
|
|
@ -77,6 +77,7 @@ 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",
|
||||
|
@ -129,6 +130,7 @@ 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",
|
||||
|
@ -174,6 +176,7 @@ func TestValidateFolderPermissionsFailsOnPermissionMismatch(t *testing.T) {
|
|||
|
||||
func TestValidateFolderPermissionsFailsOnNoRootFolder(t *testing.T) {
|
||||
b := &bundle.Bundle{
|
||||
SyncRootPath: t.TempDir(),
|
||||
Config: config.Root{
|
||||
Workspace: config.Workspace{
|
||||
RootPath: "/NotExisting",
|
||||
|
|
|
@ -3,6 +3,7 @@ package permissions
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/databricks/cli/bundle"
|
||||
"github.com/databricks/cli/bundle/libraries"
|
||||
|
@ -59,6 +60,9 @@ 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)
|
||||
})
|
||||
|
|
|
@ -19,6 +19,7 @@ import (
|
|||
|
||||
func TestApplyWorkspaceRootPermissions(t *testing.T) {
|
||||
b := &bundle.Bundle{
|
||||
SyncRootPath: t.TempDir(),
|
||||
Config: config.Root{
|
||||
Workspace: config.Workspace{
|
||||
RootPath: "/Users/foo@bar.com",
|
||||
|
@ -79,6 +80,7 @@ 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",
|
||||
|
|
Loading…
Reference in New Issue