Compare commits

..

No commits in common. "b6ab3cf4ba00c4b13f6a3f87b9acae3646b14ea8" and "d2cf054f13c2464d902738b930ca01f903614bce" have entirely different histories.

2 changed files with 2 additions and 5 deletions

View File

@ -13,7 +13,6 @@ import (
"github.com/databricks/cli/libs/diag" "github.com/databricks/cli/libs/diag"
"github.com/databricks/cli/libs/dyn" "github.com/databricks/cli/libs/dyn"
"github.com/databricks/cli/libs/dyn/dynvar" "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/apierr"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
) )
@ -139,7 +138,6 @@ the artifact_path.`,
// The user needs to have either WRITE_VOLUME or ALL_PRIVILEGES to write to the volume. // 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) canWrite := slices.Contains(allPrivileges, catalog.PrivilegeWriteVolume) || slices.Contains(allPrivileges, catalog.PrivilegeAllPrivileges)
if !canWrite { 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)) return wrapErrorMsg(fmt.Sprintf("user does not have WRITE_VOLUME grant on volume %s", volumeFullName))
} }
@ -147,7 +145,6 @@ the artifact_path.`,
// We still add this explicit check out of caution incase the API behavior changes in the future. // 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) canRead := slices.Contains(allPrivileges, catalog.PrivilegeReadVolume) || slices.Contains(allPrivileges, catalog.PrivilegeAllPrivileges)
if !canRead { 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)) return wrapErrorMsg(fmt.Sprintf("user does not have READ_VOLUME grant on volume %s", volumeFullName))
} }

View File

@ -257,7 +257,7 @@ func TestUploadArtifactFileToVolumeThatDoesNotExist(t *testing.T) {
stdout, stderr, err := testcli.RequireErrorRun(t, ctx, "bundle", "deploy") stdout, stderr, err := testcli.RequireErrorRun(t, ctx, "bundle", "deploy")
assert.Error(t, err) assert.Error(t, err)
assert.Equal(t, fmt.Sprintf(`Error: volume main.%s.doesnotexist does not exist assert.Equal(t, fmt.Sprintf(`Error: volume /Volumes/main/%s/doesnotexist does not exist: Not Found
at workspace.artifact_path at workspace.artifact_path
in databricks.yml:6:18 in databricks.yml:6:18
@ -293,7 +293,7 @@ func TestUploadArtifactToVolumeNotYetDeployed(t *testing.T) {
stdout, stderr, err := testcli.RequireErrorRun(t, ctx, "bundle", "deploy") stdout, stderr, err := testcli.RequireErrorRun(t, ctx, "bundle", "deploy")
assert.Error(t, err) assert.Error(t, err)
assert.Equal(t, fmt.Sprintf(`Error: volume main.%s.my_volume does not exist assert.Equal(t, fmt.Sprintf(`Error: volume /Volumes/main/%s/my_volume does not exist: Not Found
at workspace.artifact_path at workspace.artifact_path
resources.volumes.foo resources.volumes.foo
in databricks.yml:6:18 in databricks.yml:6:18