Skip to content

Commit 8d7324d

Browse files
authored
Update error messages to suggest 'databricks auth login' (#4587)
## Why Several error messages in the CLI suggest running `databricks configure` to create profiles. This is outdated — the golden path is `databricks auth login` (OAuth-based). Telling users to run `databricks configure` leads them into a PAT-based manual config flow instead of the preferred OAuth flow. ## Changes Update all error messages that suggest `databricks configure` to suggest `databricks auth login` instead. No functional changes — only user-facing strings. - `libs/auth/error.go` — PAT, basic auth, and env-var auth remediation suggestions - `cmd/root/auth.go` — "no workspace profiles" error - `libs/databrickscfg/profile/file.go` — "no configuration file" error - `libs/template/helpers.go` — `smallest_node_type` and `workspace_host` template helpers - `acceptance/workspace/jobs/create-error/output.txt` — acceptance test golden file Template README files (`libs/template/templates/`) also reference `databricks configure` but those are onboarding instructions, not error messages, and are out of scope for this change. ## Test Tested manually to verify the new error messages 1. Missing config file: ...please create one by running 'databricks auth login' 2. 401 with env-var PAT: Consider setting up a profile: databricks auth login --profile <name> - `go test ./libs/auth/ ./cmd/root/ ./libs/databrickscfg/profile/ ./libs/template/` — all pass - `go build ./...` — compiles cleanly - `make checks` — passes - `rg "databricks configure" --glob "*.go"` — zero matches in Go source - `rg "databricks configure" --glob "**/output.txt"` — zero matches in acceptance golden files
1 parent c451fc7 commit 8d7324d

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

acceptance/workspace/jobs/create-error/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ Auth type: Personal Access Token (pat)
88
Next steps:
99
- Verify you have the required permissions for this operation
1010
- Check your identity: databricks auth describe
11-
- Consider configuring a profile: databricks configure --profile <name>
11+
- Consider setting up a profile: databricks auth login --profile <name>
1212

1313
Exit code: 1

cmd/root/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type ErrNoWorkspaceProfiles struct {
2222
}
2323

2424
func (e ErrNoWorkspaceProfiles) Error() string {
25-
return e.path + " does not contain workspace profiles; please create one by running 'databricks configure'"
25+
return e.path + " does not contain workspace profiles; please create one by running 'databricks auth login'"
2626
}
2727

2828
type ErrNoAccountProfiles struct {

libs/auth/error.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func EnrichAuthError(ctx context.Context, cfg *config.Config, err error) error {
107107

108108
// Nudge toward profiles when using env-var-based auth.
109109
if cfg.Profile == "" {
110-
fmt.Fprint(&b, "\n - Consider configuring a profile: databricks configure --profile <name>")
110+
fmt.Fprint(&b, "\n - Consider setting up a profile: databricks auth login --profile <name>")
111111
}
112112

113113
return fmt.Errorf("%w\n%s", err, b.String())
@@ -143,14 +143,14 @@ func writeReauthSteps(ctx context.Context, cfg *config.Config, b *strings.Builde
143143

144144
case AuthTypePat:
145145
if cfg.Profile != "" {
146-
fmt.Fprintf(b, "\n - Regenerate your access token or run: databricks configure --profile %s", cfg.Profile)
146+
fmt.Fprintf(b, "\n - Regenerate your access token or run: databricks auth login --profile %s", cfg.Profile)
147147
} else {
148148
fmt.Fprint(b, "\n - Regenerate your access token")
149149
}
150150

151151
case AuthTypeBasic:
152152
if cfg.Profile != "" {
153-
fmt.Fprintf(b, "\n - Check your username/password or run: databricks configure --profile %s", cfg.Profile)
153+
fmt.Fprintf(b, "\n - Check your username/password or run: databricks auth login --profile %s", cfg.Profile)
154154
} else {
155155
fmt.Fprint(b, "\n - Check your username and password")
156156
}

libs/auth/error_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func TestEnrichAuthError(t *testing.T) {
9999
"\nHost: https://my-workspace.cloud.databricks.com" +
100100
"\nAuth type: Personal Access Token (pat)" +
101101
"\n\nNext steps:" +
102-
"\n - Regenerate your access token or run: databricks configure --profile dev" +
102+
"\n - Regenerate your access token or run: databricks auth login --profile dev" +
103103
"\n - Check your identity: databricks auth describe --profile dev",
104104
},
105105
{
@@ -147,7 +147,7 @@ func TestEnrichAuthError(t *testing.T) {
147147
"\nHost: https://my-workspace.cloud.databricks.com" +
148148
"\nAuth type: Basic" +
149149
"\n\nNext steps:" +
150-
"\n - Check your username/password or run: databricks configure --profile basic-profile" +
150+
"\n - Check your username/password or run: databricks auth login --profile basic-profile" +
151151
"\n - Check your identity: databricks auth describe --profile basic-profile",
152152
},
153153
{
@@ -195,7 +195,7 @@ func TestEnrichAuthError(t *testing.T) {
195195
"\n\nNext steps:" +
196196
"\n - Regenerate your access token" +
197197
"\n - Check your identity: databricks auth describe" +
198-
"\n - Consider configuring a profile: databricks configure --profile <name>",
198+
"\n - Consider setting up a profile: databricks auth login --profile <name>",
199199
},
200200
{
201201
name: "403 without profile (env var auth)",
@@ -210,7 +210,7 @@ func TestEnrichAuthError(t *testing.T) {
210210
"\n\nNext steps:" +
211211
"\n - Verify you have the required permissions for this operation" +
212212
"\n - Check your identity: databricks auth describe" +
213-
"\n - Consider configuring a profile: databricks configure --profile <name>",
213+
"\n - Consider setting up a profile: databricks auth login --profile <name>",
214214
},
215215
{
216216
name: "401 with account host and no profile",
@@ -226,7 +226,7 @@ func TestEnrichAuthError(t *testing.T) {
226226
"\n\nNext steps:" +
227227
"\n - Re-authenticate: databricks auth login --host https://accounts.cloud.databricks.com --account-id abc123" +
228228
"\n - Check your identity: databricks auth describe" +
229-
"\n - Consider configuring a profile: databricks configure --profile <name>",
229+
"\n - Consider setting up a profile: databricks auth login --profile <name>",
230230
},
231231
{
232232
name: "401 with unified host includes workspace-id in login",
@@ -244,7 +244,7 @@ func TestEnrichAuthError(t *testing.T) {
244244
"\n\nNext steps:" +
245245
"\n - Re-authenticate: databricks auth login --host https://unified.cloud.databricks.com --account-id acc-123 --experimental-is-unified-host --workspace-id ws-456" +
246246
"\n - Check your identity: databricks auth describe" +
247-
"\n - Consider configuring a profile: databricks configure --profile <name>",
247+
"\n - Consider setting up a profile: databricks auth login --profile <name>",
248248
},
249249
}
250250

libs/databrickscfg/profile/file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (f FileProfilerImpl) Get(ctx context.Context) (*config.File, error) {
5757
configFile, err := config.LoadFile(path)
5858
if errors.Is(err, fs.ErrNotExist) {
5959
// downstreams depend on ErrNoConfiguration. TODO: expose this error through SDK
60-
return nil, fmt.Errorf("%w at %s; please create one by running 'databricks configure'", ErrNoConfiguration, path)
60+
return nil, fmt.Errorf("%w at %s; please create one by running 'databricks auth login'", ErrNoConfiguration, path)
6161
} else if err != nil {
6262
return nil, err
6363
}

libs/template/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func loadHelpers(ctx context.Context) template.FuncMap {
9999
// Get smallest node type (follows Terraform's GetSmallestNodeType)
100100
"smallest_node_type": func() (string, error) {
101101
if w.Config.Host == "" {
102-
return "", errors.New("cannot determine target workspace, please first setup a configuration profile using 'databricks configure'")
102+
return "", errors.New("cannot determine target workspace, please first setup a configuration profile using 'databricks auth login'")
103103
}
104104
if w.Config.IsAzure() {
105105
return "Standard_D3_v2", nil
@@ -113,7 +113,7 @@ func loadHelpers(ctx context.Context) template.FuncMap {
113113
},
114114
"workspace_host": func() (string, error) {
115115
if w.Config.Host == "" {
116-
return "", errors.New("cannot determine target workspace, please first setup a configuration profile using 'databricks configure'")
116+
return "", errors.New("cannot determine target workspace, please first setup a configuration profile using 'databricks auth login'")
117117
}
118118
return w.Config.Host, nil
119119
},

0 commit comments

Comments
 (0)