Skip to content

Commit 6d67410

Browse files
authored
Fix crash in "bundle summary" (#3141)
## Changes Fix crash in "bundle summary" when there was an error. Crash introduced in #3123 (not released yet). ## Tests New acceptance test added in #3138
1 parent b56f245 commit 6d67410

3 files changed

Lines changed: 3 additions & 24 deletions

File tree

acceptance/bundle/summary/missing-libraries-file-path/output.txt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,6 @@
22
=== Initial view of resources without id and modified_status=created
33
>>> [CLI] bundle summary -o json
44
Error: file intentionally-missing.py not found
5-
Please report this issue to Databricks in the form of a GitHub issue at:
6-
https://github.com/databricks/cli
75

8-
Panic Payload: runtime error: invalid memory address or nil pointer dereference
9-
goroutine 1 [running]:
10-
runtime/debug.Stack()
11-
github.com/databricks/cli/cmd/root.Execute.func1()
12-
panic({HEX?, HEX?})
13-
github.com/databricks/cli/cmd/bundle.renderJsonOutput(HEX, HEX?)
14-
github.com/databricks/cli/cmd/bundle.renderBundle(HEX, HEX, {HEX, HEX, HEX}, HEX)
15-
github.com/databricks/cli/cmd/bundle.newSummaryCommand.func1(HEX, {HEX?, HEX?, HEX?})
16-
github.com/spf13/cobra.(*Command).execute(HEX, {HEX, HEX, HEX})
17-
github.com/spf13/cobra.(*Command).ExecuteC(HEX)
18-
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
19-
github.com/databricks/cli/cmd/root.Execute({HEX, HEX}, HEX)
20-
main.main()
216

227
Exit code: 1

acceptance/bundle/summary/missing-libraries-file-path/test.toml

Lines changed: 0 additions & 9 deletions
This file was deleted.

cmd/bundle/validate.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import (
1818
)
1919

2020
func renderJsonOutput(cmd *cobra.Command, b *bundle.Bundle) error {
21+
if b == nil {
22+
return nil
23+
}
2124
buf, err := json.MarshalIndent(b.Config.Value().AsAny(), "", " ")
2225
if err != nil {
2326
return err

0 commit comments

Comments
 (0)