From bf90d67fefe81e20360544a16d09b29d4f809d50 Mon Sep 17 00:00:00 2001 From: ncabatoff Date: Mon, 15 Jun 2020 15:25:45 -0400 Subject: [PATCH] Restart template server if it shuts down (#9200) --- command/agent/template/template.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/command/agent/template/template.go b/command/agent/template/template.go index 63e1a2b505..3ad8205045 100644 --- a/command/agent/template/template.go +++ b/command/agent/template/template.go @@ -153,7 +153,13 @@ func (ts *Server) Run(ctx context.Context, incoming chan string, templates []*ct } case err := <-ts.runner.ErrCh: ts.logger.Error("template server error", "error", err.Error()) - return + ts.runner.StopImmediately() + ts.runner, err = manager.NewRunner(runnerConfig, false) + if err != nil { + ts.logger.Error("template server failed to create", "error", err) + return + } + go ts.runner.Start() case <-ts.runner.TemplateRenderedCh(): // A template has been rendered, figure out what to do events := ts.runner.RenderEvents()