mirror of https://github.com/databricks/cli.git
Print host in `bundle validate` when passed via profile or environment variables (#1378)
## Changes Fixes to get host from the workspace client rather than only printing the host when it's configured in the bundle config. ## Tests Manually. When a profile was specified for auth. Before: ``` ➜ bundle-playground git:(master) ✗ cli bundle validate Name: bundle-playground Target: default Workspace: Host: User: shreyas.goenka@databricks.com Path: /Users/shreyas.goenka@databricks.com/.bundle/bundle-playground/default ``` After: ``` ➜ bundle-playground git:(master) ✗ cli bundle validate Name: bundle-playground Target: default Workspace: Host: https://e2-dogfood.staging.cloud.databricks.com User: shreyas.goenka@databricks.com Path: /Users/shreyas.goenka@databricks.com/.bundle/bundle-playground/default ```
This commit is contained in:
parent
6e59b13452
commit
331313ea5f
|
@ -48,7 +48,7 @@ const warningTemplate = `{{ "Warning" | yellow }}: {{ .Summary }}
|
||||||
const summaryTemplate = `Name: {{ .Config.Bundle.Name | bold }}
|
const summaryTemplate = `Name: {{ .Config.Bundle.Name | bold }}
|
||||||
Target: {{ .Config.Bundle.Target | bold }}
|
Target: {{ .Config.Bundle.Target | bold }}
|
||||||
Workspace:
|
Workspace:
|
||||||
Host: {{ .Config.Workspace.Host | bold }}
|
Host: {{ .WorkspaceClient.Config.Host | bold }}
|
||||||
User: {{ .Config.Workspace.CurrentUser.UserName | bold }}
|
User: {{ .Config.Workspace.CurrentUser.UserName | bold }}
|
||||||
Path: {{ .Config.Workspace.RootPath | bold }}
|
Path: {{ .Config.Workspace.RootPath | bold }}
|
||||||
|
|
||||||
|
@ -107,8 +107,9 @@ func renderTextOutput(cmd *cobra.Command, b *bundle.Bundle, diags diag.Diagnosti
|
||||||
// Print validation summary.
|
// Print validation summary.
|
||||||
t := template.Must(template.New("summary").Funcs(validateFuncMap).Parse(summaryTemplate))
|
t := template.Must(template.New("summary").Funcs(validateFuncMap).Parse(summaryTemplate))
|
||||||
err := t.Execute(cmd.OutOrStdout(), map[string]any{
|
err := t.Execute(cmd.OutOrStdout(), map[string]any{
|
||||||
"Config": b.Config,
|
"Config": b.Config,
|
||||||
"Trailer": buildTrailer(diags),
|
"Trailer": buildTrailer(diags),
|
||||||
|
"WorkspaceClient": b.WorkspaceClient(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue