mirror of https://github.com/databricks/cli.git
Compare commits
3 Commits
d2cf054f13
...
b6ab3cf4ba
Author | SHA1 | Date |
---|---|---|
|
b6ab3cf4ba | |
|
1a5f35f120 | |
|
4da773984a |
|
@ -13,6 +13,7 @@ import (
|
|||
"github.com/databricks/cli/libs/diag"
|
||||
"github.com/databricks/cli/libs/dyn"
|
||||
"github.com/databricks/cli/libs/dyn/dynvar"
|
||||
"github.com/databricks/cli/libs/log"
|
||||
"github.com/databricks/databricks-sdk-go/apierr"
|
||||
"github.com/databricks/databricks-sdk-go/service/catalog"
|
||||
)
|
||||
|
@ -138,6 +139,7 @@ the artifact_path.`,
|
|||
// The user needs to have either WRITE_VOLUME or ALL_PRIVILEGES to write to the volume.
|
||||
canWrite := slices.Contains(allPrivileges, catalog.PrivilegeWriteVolume) || slices.Contains(allPrivileges, catalog.PrivilegeAllPrivileges)
|
||||
if !canWrite {
|
||||
log.Debugf(ctx, "Current privileges on Volume at artifact_path: %v", allPrivileges)
|
||||
return wrapErrorMsg(fmt.Sprintf("user does not have WRITE_VOLUME grant on volume %s", volumeFullName))
|
||||
}
|
||||
|
||||
|
@ -145,6 +147,7 @@ the artifact_path.`,
|
|||
// We still add this explicit check out of caution incase the API behavior changes in the future.
|
||||
canRead := slices.Contains(allPrivileges, catalog.PrivilegeReadVolume) || slices.Contains(allPrivileges, catalog.PrivilegeAllPrivileges)
|
||||
if !canRead {
|
||||
log.Debugf(ctx, "Current privileges on Volume at artifact_path: %v", allPrivileges)
|
||||
return wrapErrorMsg(fmt.Sprintf("user does not have READ_VOLUME grant on volume %s", volumeFullName))
|
||||
}
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ func TestUploadArtifactFileToVolumeThatDoesNotExist(t *testing.T) {
|
|||
stdout, stderr, err := testcli.RequireErrorRun(t, ctx, "bundle", "deploy")
|
||||
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, fmt.Sprintf(`Error: volume /Volumes/main/%s/doesnotexist does not exist: Not Found
|
||||
assert.Equal(t, fmt.Sprintf(`Error: volume main.%s.doesnotexist does not exist
|
||||
at workspace.artifact_path
|
||||
in databricks.yml:6:18
|
||||
|
||||
|
@ -293,7 +293,7 @@ func TestUploadArtifactToVolumeNotYetDeployed(t *testing.T) {
|
|||
stdout, stderr, err := testcli.RequireErrorRun(t, ctx, "bundle", "deploy")
|
||||
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, fmt.Sprintf(`Error: volume /Volumes/main/%s/my_volume does not exist: Not Found
|
||||
assert.Equal(t, fmt.Sprintf(`Error: volume main.%s.my_volume does not exist
|
||||
at workspace.artifact_path
|
||||
resources.volumes.foo
|
||||
in databricks.yml:6:18
|
||||
|
|
Loading…
Reference in New Issue