From fca430c9ee291726340b6f0891f03c1d65414e8b Mon Sep 17 00:00:00 2001 From: jasonxie Date: Sat, 23 Nov 2019 15:06:50 +0800 Subject: [PATCH] fix debug wihout release output Signed-off-by: jasonxie --- cmd/helm/install.go | 8 ++++++-- pkg/action/install.go | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 40935db17..a0a165acf 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -113,11 +113,15 @@ func newInstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { Args: require.MinimumNArgs(1), RunE: func(_ *cobra.Command, args []string) error { rel, err := runInstall(args, client, valueOpts, out) - if err != nil { + if rel == nil && err != nil { return err } - return outfmt.Write(out, &statusPrinter{rel, settings.Debug}) + if werr := outfmt.Write(out, &statusPrinter{rel, settings.Debug}); werr != nil { + err = werr + } + + return err }, } diff --git a/pkg/action/install.go b/pkg/action/install.go index 4019dbc54..26a1493a3 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -228,7 +228,10 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release. resources, err := i.cfg.KubeClient.Build(bytes.NewBufferString(rel.Manifest), true) if err != nil { - return nil, errors.Wrap(err, "unable to build kubernetes objects from release manifest") + err = errors.Wrap(err, "unable to build kubernetes objects from release manifest") + rel.SetStatus(release.StatusFailed, err.Error()) + // Return a release with partial data so that the client can show debugging information. + return rel, err } // Install requires an extra validation step of checking that resources