Check for err before working with newRelease. (#4630)

Should fix #4585.

Signed-off-by: Steve Wolter <swolter@google.com>
pull/4648/head
Steve Wolter 6 years ago committed by Matthew Fisher
parent a297a0a7fe
commit e868da1705

@ -150,6 +150,8 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) (
return nil, err return nil, err
} }
res := &services.UpdateReleaseResponse{}
newRelease, err := s.prepareRelease(&services.InstallReleaseRequest{ newRelease, err := s.prepareRelease(&services.InstallReleaseRequest{
Chart: req.Chart, Chart: req.Chart,
Values: req.Values, Values: req.Values,
@ -161,11 +163,6 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) (
Timeout: req.Timeout, Timeout: req.Timeout,
Wait: req.Wait, Wait: req.Wait,
}) })
// update new release with next revision number so as to append to the old release's history
newRelease.Version = oldRelease.Version + 1
res := &services.UpdateReleaseResponse{Release: newRelease}
if err != nil { if err != nil {
s.Log("failed update prepare step: %s", err) s.Log("failed update prepare step: %s", err)
// On dry run, append the manifest contents to a failed release. This is // On dry run, append the manifest contents to a failed release. This is
@ -176,6 +173,10 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) (
return res, err return res, err
} }
// update new release with next revision number so as to append to the old release's history
newRelease.Version = oldRelease.Version + 1
res.Release = newRelease
if req.DryRun { if req.DryRun {
s.Log("dry run for %s", newRelease.Name) s.Log("dry run for %s", newRelease.Name)
res.Release.Info.Description = "Dry run complete" res.Release.Info.Description = "Dry run complete"

Loading…
Cancel
Save