Return empty string instead of nil when linting on required

This allows lint to work in scenarios when required is used in secrets or it's output is passed to another function.
Due to lint mode no longer failing on missing value in required it is passing nil through which not all functions can accept.

Fixes #4747

Signed-off-by: Helgi Þorbjörnsson <helgith@gmail.com>
pull/4748/head
Helgi Þorbjörnsson 7 years ago
parent c095b9232d
commit 1d1636d0da

@ -161,7 +161,8 @@ func (e *Engine) alterFuncMap(t *template.Template, referenceTpls map[string]ren
log.Printf("[INFO] Missing required value: %s", warn) log.Printf("[INFO] Missing required value: %s", warn)
return val, nil return val, nil
} }
return val, fmt.Errorf(warn) // Convert nil to "" in case required is piped into other functions
return "", fmt.Errorf(warn)
} else if _, ok := val.(string); ok { } else if _, ok := val.(string); ok {
if val == "" { if val == "" {
if e.LintMode { if e.LintMode {

Loading…
Cancel
Save