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.
pull/873/head
Matt Butcher 8 years ago
parent 22ac61469f
commit 90c46e896d

@ -94,12 +94,18 @@ func tableLookup(v Values, simple string) (Values, error) {
if !ok {
return v, ErrNoTable
}
//vv, ok := v2.(map[string]interface{})
vv, ok := v2.(Values)
if !ok {
return vv, ErrNoTable
if vv, ok := v2.(map[string]interface{}); ok {
return vv, nil
}
// 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.

Loading…
Cancel
Save