Commit 90c46e89 authored by Matt Butcher's avatar Matt Butcher

fix(chartutil): fix Table() method to test Values

This makes the Table() method more flexible than the original version.
It allows either a map[string]interface{} or a chartutil.Values to be
treated as a table.
parent 22ac6146
...@@ -94,12 +94,18 @@ func tableLookup(v Values, simple string) (Values, error) { ...@@ -94,12 +94,18 @@ func tableLookup(v Values, simple string) (Values, error) {
if !ok { if !ok {
return v, ErrNoTable return v, ErrNoTable
} }
//vv, ok := v2.(map[string]interface{}) if vv, ok := v2.(map[string]interface{}); ok {
vv, ok := v2.(Values) return vv, nil
if !ok {
return vv, ErrNoTable
} }
// This catches a case where a value is of type Values, but doesn't (for some
// reason) match the map[string]interface{}. This has been observed in the
// wild, and might be a result of a nil map of type Values.
if vv, ok := v2.(Values); ok {
return vv, nil return vv, nil
}
return map[string]interface{}{}, ErrNoTable
} }
// ReadValues will parse YAML byte data into a Values. // ReadValues will parse YAML byte data into a Values.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment