mirror of https://github.com/databricks/cli.git
Ignore metastore permission error during template generation (#1819)
## Changes This extends the `{{default_catalog}}` helper in templates to ignore any `PERMISSION_DENIED` error. We're still reviewing when exactly this error occurs, but if it does, it should not break templates. We should fall back to assuming there's no default catalog (and no UC) instead. ## Testing I have not been able to reproduce this issue, but there is a customer report about "access denied to clusters that don't have unity catalog enabled" being returned on a non-UC workspace. The error code in this PR corresponds to that message. ## Next steps We'll work together with the UC team to review if this error even makes sense for this API. If that discussion leads to a behavior change in the API we can update the CLI code again.
This commit is contained in:
parent
845d23ac21
commit
08a0d083c3
|
@ -128,8 +128,8 @@ func loadHelpers(ctx context.Context) template.FuncMap {
|
|||
metastore, err := w.Metastores.Current(ctx)
|
||||
if err != nil {
|
||||
var aerr *apierr.APIError
|
||||
if errors.As(err, &aerr) && aerr.ErrorCode == "METASTORE_DOES_NOT_EXIST" {
|
||||
// Workspace doesn't have a metastore assigned, ignore error
|
||||
if errors.As(err, &aerr) && (aerr.ErrorCode == "PERMISSION_DENIED" || aerr.ErrorCode == "METASTORE_DOES_NOT_EXIST") {
|
||||
// Ignore: access denied or workspace doesn't have a metastore assigned
|
||||
empty_default := ""
|
||||
cachedCatalog = &empty_default
|
||||
return "", nil
|
||||
|
|
Loading…
Reference in New Issue