Merge pull request #805 from adamreese/fix/values-nil-map

fix(chartutil): fix nil error on values
pull/806/head
Adam Reese 9 years ago
commit 61021dde35

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

@ -53,6 +53,10 @@ func TestRender(t *testing.T) {
if out["test1"] != expect {
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) {

Loading…
Cancel
Save