mirror of https://github.com/databricks/cli.git
dont show warning twice
This commit is contained in:
parent
a559bd05be
commit
48b9571f3f
|
@ -26,7 +26,7 @@ func (f *folderPermissions) Apply(ctx context.Context, b bundle.ReadOnlyBundle)
|
||||||
|
|
||||||
rootPath := b.Config().Workspace.RootPath
|
rootPath := b.Config().Workspace.RootPath
|
||||||
paths := []string{}
|
paths := []string{}
|
||||||
if !libraries.IsVolumesPath(rootPath) {
|
if !libraries.IsVolumesPath(rootPath) && !libraries.IsWorkspaceSharedPath(rootPath) {
|
||||||
paths = append(paths, rootPath)
|
paths = append(paths, rootPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,9 +40,15 @@ func (f *folderPermissions) Apply(ctx context.Context, b bundle.ReadOnlyBundle)
|
||||||
b.Config().Workspace.StatePath,
|
b.Config().Workspace.StatePath,
|
||||||
b.Config().Workspace.ResourcePath,
|
b.Config().Workspace.ResourcePath,
|
||||||
} {
|
} {
|
||||||
if !strings.HasPrefix(p, rootPath) && !libraries.IsVolumesPath(p) {
|
if libraries.IsWorkspaceSharedPath(p) || libraries.IsVolumesPath(p) {
|
||||||
paths = append(paths, p)
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(p, rootPath) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
paths = append(paths, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
|
@ -41,3 +41,7 @@ func IsWorkspaceLibrary(library *compute.Library) bool {
|
||||||
func IsVolumesPath(path string) bool {
|
func IsVolumesPath(path string) bool {
|
||||||
return strings.HasPrefix(path, "/Volumes/")
|
return strings.HasPrefix(path, "/Volumes/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsWorkspaceSharedPath(path string) bool {
|
||||||
|
return strings.HasPrefix(path, "/Workspace/Shared/")
|
||||||
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ package permissions
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/databricks/cli/bundle"
|
"github.com/databricks/cli/bundle"
|
||||||
|
"github.com/databricks/cli/bundle/libraries"
|
||||||
"github.com/databricks/cli/libs/diag"
|
"github.com/databricks/cli/libs/diag"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -21,17 +21,13 @@ func (*validateSharedRootPermissions) Name() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*validateSharedRootPermissions) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics {
|
func (*validateSharedRootPermissions) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics {
|
||||||
if isWorkspaceSharedRoot(b.Config.Workspace.RootPath) {
|
if libraries.IsWorkspaceSharedPath(b.Config.Workspace.RootPath) {
|
||||||
return isUsersGroupPermissionSet(b)
|
return isUsersGroupPermissionSet(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func isWorkspaceSharedRoot(path string) bool {
|
|
||||||
return strings.HasPrefix(path, "/Workspace/Shared/")
|
|
||||||
}
|
|
||||||
|
|
||||||
// isUsersGroupPermissionSet checks that top-level permissions set for bundle contain group_name: users with CAN_MANAGE permission.
|
// isUsersGroupPermissionSet checks that top-level permissions set for bundle contain group_name: users with CAN_MANAGE permission.
|
||||||
func isUsersGroupPermissionSet(b *bundle.Bundle) diag.Diagnostics {
|
func isUsersGroupPermissionSet(b *bundle.Bundle) diag.Diagnostics {
|
||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
Loading…
Reference in New Issue