Change switch to regex

reviewable/pr2648/r4
Scott Rigby 8 years ago
parent 269b5766c1
commit 67c5129e51

@ -21,6 +21,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"log" "log"
"regexp"
"strings" "strings"
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
@ -282,11 +283,13 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) (map[string]interf
// This allows Helm's various sources of values (value files or --set) to // This allows Helm's various sources of values (value files or --set) to
// remove incompatible keys from any previous chart, file, or set values. // remove incompatible keys from any previous chart, file, or set values.
// ref: http://www.yaml.org/spec/1.2/spec.html#id2803362 // ref: http://www.yaml.org/spec/1.2/spec.html#id2803362
switch val { var nullPattern = regexp.MustCompile("^(?:null|Null|NULL|~)$")
case "null", "Null", "NULL", "~": if str, ok := val.(string); ok {
if nullPattern.MatchString(str) {
delete(v, key) delete(v, key)
continue continue
} }
}
if _, ok := v[key]; !ok { if _, ok := v[key]; !ok {
// If the key is not in v, copy it from nv. // If the key is not in v, copy it from nv.

Loading…
Cancel
Save