Commit 197e466b authored by Michelle Noorali's avatar Michelle Noorali

ref(*): return resource update errors

Resolves #1058
parent 76defc62
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment