Skip to content

Commit 67d4ab5

Browse files
authored
fix: skip resources not found for json patch (#1294)
1 parent bccd483 commit 67d4ab5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: pkg/modules/generators/app_configurations_generator.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ func JSONPatch(resources v1.Resources, patcher *v1.Patcher) error {
217217
for id, jsonPatcher := range patcher.JSONPatchers {
218218
res, ok := resIndex[id]
219219
if !ok {
220-
return fmt.Errorf("target patch resource %s not found", id)
220+
log.Warnf("target patch resource %s not found, skipped", id)
221+
continue
221222
}
222223

223224
target := jsonutil.Marshal2String(res.Attributes)

Diff for: pkg/modules/generators/app_configurations_generator_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ func TestJsonPatch(t *testing.T) {
499499
"notfound": {Type: v1.MergePatch, Payload: []byte(`{"key": "value"}`)},
500500
},
501501
})
502-
assert.Error(t, err)
502+
assert.Nil(t, err)
503503
})
504504

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

0 commit comments

Comments
 (0)