Skip to content

Commit

Permalink
fix: ensure failure on missing template keys
Browse files Browse the repository at this point in the history
  • Loading branch information
rajiteh authored and Raj Perera committed Dec 6, 2021
1 parent cff919e commit 61cb346
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/target/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,7 @@ func Summary(targets []*Target) fleet.BundleSummary {
return bundleSummary
}

// funcMap returns a mapping of all of the functions that Engine has.
// Also remove potentially dangerous operations
// tplFuncMap returns a mapping of all of the functions from sprig but removes potentially dangerous operations
func tplFuncMap() template.FuncMap {
f := sprig.TxtFuncMap()
delete(f, "env")
Expand All @@ -552,7 +551,7 @@ func processTemplateValues(valuesMap map[string]interface{}, templateContext map
return nil, err
}

tpl, err := template.New("values").Funcs(tplFuncMap()).Parse(string(valuesMapStr))
tpl, err := template.New("values").Funcs(tplFuncMap()).Option("missingkey=error").Parse(string(valuesMapStr))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 61cb346

Please sign in to comment.