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:
shreyas-goenka 2024-04-19 17:13:50 +05:30 committed by GitHub
parent 6e59b13452
commit 331313ea5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -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 }}
@ -109,6 +109,7 @@ func renderTextOutput(cmd *cobra.Command, b *bundle.Bundle, diags diag.Diagnosti
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