Merge pull request #3645 from scriptonist/Issue3290

Recover from a tiller pod crash caused due to errors in values.yaml
pull/3671/head
Taylor Thomas 8 years ago committed by GitHub
commit dede3ff1e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -196,7 +196,7 @@ func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap {
} }
// render takes a map of templates/values and renders them. // render takes a map of templates/values and renders them.
func (e *Engine) render(tpls map[string]renderable) (map[string]string, error) { func (e *Engine) render(tpls map[string]renderable) (rendered map[string]string, err error) {
// Basically, what we do here is start with an empty parent template and then // Basically, what we do here is start with an empty parent template and then
// build up a list of templates -- one for each file. Once all of the templates // build up a list of templates -- one for each file. Once all of the templates
// have been parsed, we loop through again and execute every template. // have been parsed, we loop through again and execute every template.
@ -204,6 +204,11 @@ func (e *Engine) render(tpls map[string]renderable) (map[string]string, error) {
// The idea with this process is to make it possible for more complex templates // The idea with this process is to make it possible for more complex templates
// to share common blocks, but to make the entire thing feel like a file-based // to share common blocks, but to make the entire thing feel like a file-based
// template engine. // template engine.
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("rendering template failed: %v", r)
}
}()
t := template.New("gotpl") t := template.New("gotpl")
if e.Strict { if e.Strict {
t.Option("missingkey=error") t.Option("missingkey=error")
@ -241,7 +246,7 @@ func (e *Engine) render(tpls map[string]renderable) (map[string]string, error) {
} }
} }
rendered := make(map[string]string, len(files)) rendered = make(map[string]string, len(files))
var buf bytes.Buffer var buf bytes.Buffer
for _, file := range files { for _, file := range files {
// Don't render partials. We don't care out the direct output of partials. // Don't render partials. We don't care out the direct output of partials.

Loading…
Cancel
Save