Skip to content

Commit

Permalink
Merge pull request #279 from coveooss/DT-7517-The-tests-are-failing-w…
Browse files Browse the repository at this point in the history
…hen-trying-to-build-the-new-tgf-image

Restore missing key default behavior
  • Loading branch information
jocgir authored Dec 3, 2024
2 parents 1558601 + 682f2bc commit 0f91b13
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions template/extra_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,14 +499,16 @@ func optimizedRunTemplate(t *Template, withClone bool, source string, args ...in
// Ignore missing keys
internalTemplate.Option("missingkey=default")
} else {
// Return error on missing keys in order to retry
// Return error on missing keys in order to retry but with context cloning
// and ensure that we restore the original behavior on error handling
defer func() { internalTemplate.Option("missingkey=default") }()
internalTemplate.Option("missingkey=error")
}

// We execute the resulting template
if err = internalTemplate.Execute(&out, context); err != nil {
if !withClone {
TemplateLog.Debug("Running template with context cloning because:", err)
InternalLog.Debug("Running template with context cloning because:", err)
t.context = parentContext
return optimizedRunTemplate(t, true, source, args...)
}
Expand Down

0 comments on commit 0f91b13

Please sign in to comment.