From 310ef9bbcb5fd5f6320cff9230c0e81ccbc9e1e7 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Thu, 30 Jun 2016 12:45:44 -0600 Subject: [PATCH] fix(helm): fix linter test panic Handle a previously unhandled error in the linter. This simply bails out if a chart's values files do not parse. Also, changed the implementation of CoalesceValues to return a map even on error. --- pkg/chartutil/values.go | 2 +- pkg/lint/rules/template.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index b6816f605..d135f41df 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -312,7 +312,7 @@ func ToRenderValues(chrt *chart.Chart, chrtVals *chart.Config, options ReleaseOp vals, err := CoalesceValues(chrt, chrtVals, nil) if err != nil { - return nil, err + return overrides, err } overrides["Values"] = vals diff --git a/pkg/lint/rules/template.go b/pkg/lint/rules/template.go index a28157658..f83cb63b9 100644 --- a/pkg/lint/rules/template.go +++ b/pkg/lint/rules/template.go @@ -55,6 +55,12 @@ func Templates(linter *support.Linter) { options := chartutil.ReleaseOptions{Name: "testRelease", Time: timeconv.Now(), Namespace: "testNamespace"} valuesToRender, err := chartutil.ToRenderValues(chart, chart.Values, options) + if err != nil { + // FIXME: This seems to generate a duplicate, but I can't find where the first + // error is coming from. + //linter.RunLinterRule(support.ErrorSev, err) + return + } renderedContentMap, err := engine.New().Render(chart, valuesToRender) renderOk := linter.RunLinterRule(support.ErrorSev, validateNoError(err))