Skip to content

Commit

Permalink
fix: skip resources not found for json patch (#1294)
Browse files Browse the repository at this point in the history
  • Loading branch information
liu-hm19 authored Sep 23, 2024
1 parent bccd483 commit 67d4ab5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/modules/generators/app_configurations_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ func JSONPatch(resources v1.Resources, patcher *v1.Patcher) error {
for id, jsonPatcher := range patcher.JSONPatchers {
res, ok := resIndex[id]
if !ok {
return fmt.Errorf("target patch resource %s not found", id)
log.Warnf("target patch resource %s not found, skipped", id)
continue
}

target := jsonutil.Marshal2String(res.Attributes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ func TestJsonPatch(t *testing.T) {
"notfound": {Type: v1.MergePatch, Payload: []byte(`{"key": "value"}`)},
},
})
assert.Error(t, err)
assert.Nil(t, err)
})

t.Run("MergePatch", func(t *testing.T) {
Expand Down

0 comments on commit 67d4ab5

Please sign in to comment.