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