mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
fix: correct visitMappingNodeFields
This commit adjusts visitMappingNodeFields so that it no longer assumes the mapping node has unique keys.
This commit is contained in:
@@ -647,16 +647,16 @@ func (s MapEntrySetter) Filter(rn *RNode) (*RNode, error) {
|
||||
}
|
||||
|
||||
content := rn.Content()
|
||||
stillMissing := true
|
||||
fieldStillNotFound := true
|
||||
visitFieldsWhileTrue(content, func(key, value *yaml.Node, keyIndex int) bool {
|
||||
if key.Value == s.Name {
|
||||
content[keyIndex] = s.Key.YNode()
|
||||
content[keyIndex+1] = s.Value.YNode()
|
||||
stillMissing = false
|
||||
fieldStillNotFound = false
|
||||
}
|
||||
return stillMissing
|
||||
return fieldStillNotFound
|
||||
})
|
||||
if !stillMissing {
|
||||
if !fieldStillNotFound {
|
||||
return rn, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user