error out if patchesJson6902 target can't be found, fixes #335

This commit is contained in:
David Schweikert
2018-10-03 21:53:45 +02:00
parent a1538c5610
commit 279826f6d6

View File

@@ -18,7 +18,6 @@ package transformer
import (
"fmt"
"log"
"sigs.k8s.io/kustomize/pkg/resmap"
"sigs.k8s.io/kustomize/pkg/resource"
@@ -37,8 +36,7 @@ func findTargetObj(m resmap.ResMap, targetId resource.ResId) (*resource.Resource
}
if len(matchedIds) == 0 {
log.Printf("Couldn't find any object to apply the json patch %v, skipping it.", targetId)
return nil, nil
return nil, fmt.Errorf("couldn't find any object to apply the json patch %v", targetId)
}
if len(matchedIds) > 1 {
return nil, fmt.Errorf("found multiple objects that the patch can apply %v", matchedIds)