Use PATCH when pausing/resuming objects and CalculatePatches to get the patch

This commit is contained in:
Michal Fojtik
2016-10-27 13:01:50 +02:00
parent e4b41dd292
commit 0faa27e62d
7 changed files with 88 additions and 67 deletions

View File

@@ -125,13 +125,19 @@ func CalculatePatches(infos []*resource.Info, encoder runtime.Encoder, mutateFn
for _, info := range infos {
patch := &Patch{Info: info}
patch.Before, patch.Err = runtime.Encode(encoder, info.Object)
ok, err := mutateFn(info)
if !ok {
if patch.Err != nil {
patches = append(patches, patch)
continue
}
ok, err := mutateFn(info)
if err != nil {
patch.Err = err
patches = append(patches, patch)
continue
}
if !ok {
continue
}
patches = append(patches, patch)
if patch.Err != nil {