Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nextchanges/cli/7638.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* `databricks auth profiles --skip-validate` omits the `Valid` column instead of reporting `NO` for every profile. ([#7638](https://github.com/databricks/cli/pull/7638))
12 changes: 6 additions & 6 deletions acceptance/cmd/auth/switch/nominal/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ default_profile = profile-a
=== Profiles after first switch

>>> [CLI] auth profiles --skip-validate
Name Host Valid
profile-a (Default) [DATABRICKS_URL] NO
profile-b [DATABRICKS_URL] NO
Name Host
profile-a (Default) [DATABRICKS_URL]
profile-b [DATABRICKS_URL]

=== Switch to profile-b

Expand All @@ -27,6 +27,6 @@ default_profile = profile-b
=== Profiles after second switch

>>> [CLI] auth profiles --skip-validate
Name Host Valid
profile-a [DATABRICKS_URL] NO
profile-b (Default) [DATABRICKS_URL] NO
Name Host
profile-a [DATABRICKS_URL]
profile-b (Default) [DATABRICKS_URL]
11 changes: 7 additions & 4 deletions cmd/auth/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ func newProfilesCommand() *cobra.Command {
Use: "profiles",
Short: "Lists profiles from ~/.databrickscfg",
Annotations: map[string]string{
// With --skip-validate nothing is validated, so the Valid column is
// omitted instead of reporting NO for every profile.
"template": cmdio.Heredoc(`
{{header "Name"}} {{header "Host"}} {{header "Valid"}}
{{range .Profiles}}{{.Name | green}}{{if .Default}} (Default){{end}} {{.Host|cyan}} {{bool .Valid}}
{{header "Name"}} {{header "Host"}}{{if not .SkipValidate}} {{header "Valid"}}{{end}}
{{range .Profiles}}{{.Name | green}}{{if .Default}} (Default){{end}} {{.Host|cyan}}{{if not $.SkipValidate}} {{bool .Valid}}{{end}}
{{end}}`),
},
}
Expand Down Expand Up @@ -175,8 +177,9 @@ func newProfilesCommand() *cobra.Command {
}
wg.Wait()
return cmdio.Render(cmd.Context(), struct {
Profiles []*profileMetadata `json:"profiles"`
}{profiles})
Profiles []*profileMetadata `json:"profiles"`
SkipValidate bool `json:"-"`
}{profiles, skipValidate})
}

return cmd
Expand Down
Loading