only run replace after patch failed

Signed-off-by: Johannes Gesenhues <johannges@gmail.com>
Signed-off-by: jgesenhu <johannes.gesenhues@obi.de>
pull/6933/head
jgesenhu 6 years ago
parent f39e13b8dd
commit 2bb3404568

@ -389,8 +389,10 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
}
return nil
}
// if --force is applied, attempt to replace the existing resource with the new object.
// send patch to server
obj, err = helper.Patch(target.Namespace, target.Name, patchType, patch, nil)
if err != nil {
// if --force is applied, attempt to replace the existing resource, that is not patchable with the new object.
if force {
obj, err = helper.Replace(target.Namespace, target.Name, true, target.Object)
if err != nil {
@ -398,13 +400,9 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
}
log.Printf("Replaced %q with kind %s for kind %s\n", target.Name, currentObj.GetObjectKind().GroupVersionKind().Kind, kind)
} else {
// send patch to server
obj, err = helper.Patch(target.Namespace, target.Name, patchType, patch, nil)
if err != nil {
return errors.Wrapf(err, "cannot patch %q with kind %s", target.Name, kind)
}
}
target.Refresh(obj, true)
return nil
}

@ -133,7 +133,6 @@ func (s *Storage) DeployedAll(name string) ([]*rspb.Release, error) {
ls, err := s.Driver.Query(map[string]string{
"name": name,
"owner": "helm",
"status": "deployed",
})
if err == nil {
return ls, nil

Loading…
Cancel
Save