diff --git a/cli/cmd/config/read/command.go b/cli/cmd/config/read/command.go index 245e283c3a..e2258bd013 100644 --- a/cli/cmd/config/read/command.go +++ b/cli/cmd/config/read/command.go @@ -160,10 +160,9 @@ func (c *ReadCommand) checkHelmInstallation(settings *helmCLI.EnvSettings, uiLog valuesYaml, err := yaml.Marshal(rel.Config) if err != nil { - c.UI.Output("%+v", err, terminal.WithErrorStyle()) - } else { - c.UI.Output(string(valuesYaml)) + return err } + c.UI.Output(string(valuesYaml)) return nil } diff --git a/cli/cmd/config/read/command_test.go b/cli/cmd/config/read/command_test.go index 3881e44f99..a3716cf3c1 100644 --- a/cli/cmd/config/read/command_test.go +++ b/cli/cmd/config/read/command_test.go @@ -3,6 +3,7 @@ package read import ( "bytes" "context" + "errors" "flag" "fmt" "io" @@ -45,8 +46,18 @@ func TestConfigRead(t *testing.T) { }, expectedReturnCode: 0, }, + "error": { + messages: []string{"error", "\n"}, + + helmActionsRunner: &helm.MockActionRunner{ + GetStatusFunc: func(status *action.Status, name string) (*helmRelease.Release, error) { + return nil, errors.New("error") + }, + }, + expectedReturnCode: 1, + }, "some config": { - messages: []string{"\n"}, + messages: []string{"global: \"true\"", "\n"}, helmActionsRunner: &helm.MockActionRunner{ GetStatusFunc: func(status *action.Status, name string) (*helmRelease.Release, error) {