Fixing issue with non-existant .Template when using tpl function

This is a regression accidently introduced in #9957.

A delete call had been used on the Template key of vals. This caused
a condition where Template was not available when rendering via tpl.
The delete happened after ExecuteTemplate so the issue is surpsising.
It may possibly be a race condition. Existing tests did not catch it.
I tried to create a test that directly tested the issue and was
unable to replicate the error seen with real charts. This leads me
to believe it is a race condition in the underlying Go template
package.

The delete call was not there before #9957. It should be safe to
remove and keep that information.

Closes #10082

Signed-off-by: Matt Farina <matt.farina@suse.com>
(cherry picked from commit f895948ae2)
release-3.7 v3.7.0-rc.2
Matt Farina 4 years ago
parent 548fae169a
commit 4a7c306aa9
No known key found for this signature in database
GPG Key ID: 92C44A3D421FF7F9

@ -260,7 +260,6 @@ func (e Engine) renderWithReferences(tpls, referenceTpls map[string]renderable)
if err := t.ExecuteTemplate(&buf, filename, vals); err != nil { if err := t.ExecuteTemplate(&buf, filename, vals); err != nil {
return map[string]string{}, cleanupExecError(filename, err) return map[string]string{}, cleanupExecError(filename, err)
} }
delete(vals, "Template")
// Work around the issue where Go will emit "<no value>" even if Options(missing=zero) // Work around the issue where Go will emit "<no value>" even if Options(missing=zero)
// is set. Since missing=error will never get here, we do not need to handle // is set. Since missing=error will never get here, we do not need to handle

Loading…
Cancel
Save