Merge pull request #2814 from monopole/moofloaves

Fix more constants.
This commit is contained in:
Jeff Regan
2020-08-07 13:35:13 -07:00
committed by GitHub
2 changed files with 4 additions and 3 deletions

View File

@@ -86,7 +86,7 @@ func (fltr Filter) field(obj *yaml.RNode) error {
// create the field if it is missing: must be a mapping node
lookupField = yaml.LookupCreate(yaml.MappingNode, fieldName)
kind = yaml.MappingNode
tag = "!!map" // TODO: change to yaml.NodeTagMap
tag = yaml.NodeTagMap
}
// locate (or maybe create) the field
@@ -97,7 +97,7 @@ func (fltr Filter) field(obj *yaml.RNode) error {
// if the value exists, but is null, then change it to the creation type
// TODO: update yaml.LookupCreate to support this
if field.YNode().Tag == "!!null" { // TODO: change to yaml.NodeTagNull
if field.YNode().Tag == yaml.NodeTagNull {
field.YNode().Kind = kind
field.YNode().Tag = tag
}

View File

@@ -8,6 +8,7 @@ import (
expansion2 "sigs.k8s.io/kustomize/api/internal/accumulator/expansion"
filtertest_test "sigs.k8s.io/kustomize/api/testutils/filtertest"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kyaml/yaml"
)
func TestFilter(t *testing.T) {
@@ -251,7 +252,7 @@ metadata:
config.kubernetes.io/index: '0'
data:
1: str
' at path 'data': invalid map key: 1, type: !!int`,
' at path 'data': invalid map key: 1, type: ` + yaml.NodeTagInt,
filter: Filter{
MappingFunc: expansion2.MappingFuncFor(replacementCounts, map[string]interface{}{
"VAR": int64(5),