ref(*): return resource update errors

Resolves #1058
pull/1099/head
Michelle Noorali 8 years ago
parent 76defc62ee
commit 197e466b9a

@ -125,7 +125,7 @@ func (u *upgradeCmd) run() error {
_, err = u.client.UpdateRelease(u.release, chartPath, helm.UpdateValueOverrides(rawVals), helm.UpgradeDryRun(u.dryRun), helm.UpgradeDisableHooks(u.disableHooks))
if err != nil {
return prettyError(err)
return fmt.Errorf("UPGRADE FAILED: %v", prettyError(err))
}
success := u.release + " has been upgraded. Happy Helming!\n"

@ -224,7 +224,7 @@ func (s *releaseServer) performUpdate(originalRelease, updatedRelease *release.R
original := bytes.NewBufferString(originalRelease.Manifest)
modified := bytes.NewBufferString(updatedRelease.Manifest)
if err := kubeCli.Update(updatedRelease.Namespace, original, modified); err != nil {
return nil, fmt.Errorf("Update of %s failed: %s", updatedRelease.Name, err)
return nil, err
}
// post-upgrade hooks

@ -22,6 +22,7 @@ import (
"io"
"log"
"reflect"
"strings"
"time"
"k8s.io/kubernetes/pkg/api"
@ -157,8 +158,9 @@ func (c *Client) Update(namespace string, currentReader, modifiedReader io.Reade
}
modifiedInfos := []*resource.Info{}
updateErrors := []string{}
modified.Visit(func(info *resource.Info, err error) error {
err = modified.Visit(func(info *resource.Info, err error) error {
modifiedInfos = append(modifiedInfos, info)
if err != nil {
return err
@ -188,15 +190,23 @@ func (c *Client) Update(namespace string, currentReader, modifiedReader io.Reade
if err := updateResource(info, currentObj); err != nil {
log.Printf("error updating the resource %s:\n\t %v", resourceName, err)
return err
updateErrors = append(updateErrors, err.Error())
}
return err
return nil
})
deleteUnwantedResources(currentInfos, modifiedInfos)
if err != nil {
return err
} else if len(updateErrors) != 0 {
return fmt.Errorf(strings.Join(updateErrors, " && "))
}
return nil
}
// Delete deletes kubernetes resources from an io.reader

Loading…
Cancel
Save