mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-14 02:20:53 +00:00
implements to replacements value in the structured data
This commit is contained in:
@@ -830,6 +830,10 @@ func (e *InvalidNodeKindError) Error() string {
|
||||
return msg
|
||||
}
|
||||
|
||||
func (e *InvalidNodeKindError) Unwrap() error {
|
||||
return errors.Errorf("InvalidNodeKindError")
|
||||
}
|
||||
|
||||
func (e *InvalidNodeKindError) ActualNodeKind() Kind {
|
||||
return e.node.YNode().Kind
|
||||
}
|
||||
|
||||
@@ -137,10 +137,20 @@ func (p *PathMatcher) visitEveryElem(elem *RNode) error {
|
||||
func (p *PathMatcher) doField(rn *RNode) (*RNode, error) {
|
||||
// lookup the field
|
||||
field, err := rn.Pipe(Get(p.Path[0]))
|
||||
if err != nil || (!IsCreate(p.Create) && field == nil) {
|
||||
if err != nil {
|
||||
// check error is an invalid kind error
|
||||
invalidKindErr := &InvalidNodeKindError{}
|
||||
if errors.As(err, &invalidKindErr) {
|
||||
// if the field is valid json or yaml, continue to lookup the next part of the path
|
||||
fmt.Print("-----------------------------\nOUTPUT: ", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !IsCreate(p.Create) && field == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if IsCreate(p.Create) && field == nil {
|
||||
var nextPart string
|
||||
if len(p.Path) > 1 {
|
||||
|
||||
Reference in New Issue
Block a user