fix(chartutil): fix nil error on values

Fixes: https://github.com/kubernetes/helm/issues/803
pull/805/head
Adam Reese 8 years ago
parent 9fdb9eebcf
commit d95a144563

@ -65,10 +65,12 @@ func tableLookup(v Values, simple string) (Values, error) {
} }
// ReadValues will parse YAML byte data into a Values. // ReadValues will parse YAML byte data into a Values.
func ReadValues(data []byte) (Values, error) { func ReadValues(data []byte) (vals Values, err error) {
out := map[string]interface{}{} vals = make(map[string]interface{})
err := yaml.Unmarshal(data, &out) if len(data) > 0 {
return out, err err = yaml.Unmarshal(data, &vals)
}
return
} }
// ReadValuesFile will parse a YAML file into a Values. // ReadValuesFile will parse a YAML file into a Values.

@ -53,6 +53,10 @@ func TestRender(t *testing.T) {
if out["test1"] != expect { if out["test1"] != expect {
t.Errorf("Expected %q, got %q", expect, out["test1"]) t.Errorf("Expected %q, got %q", expect, out["test1"])
} }
if _, err := e.Render(c, &chart.Config{}, overrides); err != nil {
t.Errorf("Unexpected error: %s", err)
}
} }
func TestRenderInternals(t *testing.T) { func TestRenderInternals(t *testing.T) {

Loading…
Cancel
Save