From 90c46e896de13064d3c8d5b36e0cbf1a68cccd9b Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Thu, 23 Jun 2016 15:18:24 -0600 Subject: [PATCH] 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. --- pkg/chartutil/values.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index 6aa1c5cd2..3987c5a16 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -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.