From 6cfaa4ebf27374789a421246bed3b85931e3055b Mon Sep 17 00:00:00 2001 From: scriptonist Date: Fri, 9 Mar 2018 18:30:01 +0530 Subject: [PATCH] Added code to recover from a tiller pod crash in an event of template render failure --- pkg/engine/engine.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index 46e0a59cf..e83476eae 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -19,6 +19,7 @@ package engine import ( "bytes" "fmt" + "log" "path" "sort" "strings" @@ -204,6 +205,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 // to share common blocks, but to make the entire thing feel like a file-based // template engine. + defer func() { + if err := recover(); err != nil { + log.Printf("rendering template failed: %v\n", err) + } + }() t := template.New("gotpl") if e.Strict { t.Option("missingkey=error")