From 991b6bb4f992eed2b313fb59d781c30f86968423 Mon Sep 17 00:00:00 2001 From: Fabio Forni Date: Sun, 26 Nov 2023 10:35:15 +0100 Subject: [PATCH] installer/template.go: Do not override the error if no variable is found --- installer/template.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/installer/template.go b/installer/template.go index f647c7d..4ae1224 100644 --- a/installer/template.go +++ b/installer/template.go @@ -89,14 +89,15 @@ func (t *Template) GobDecode(data []byte) error { } func (t Template) replaceTag(w io.Writer, varName string) (int, error) { - if val, err := t.variables.Get(t.serviceName, varName); err == nil { + val, err := t.variables.Get(t.serviceName, varName) + if err == nil { // Matched a variable local to the service. return w.Write([]byte(val)) } parentName, parentVar, found := strings.Cut(varName, service.VarParentSep) if !found { - return 0, repo.ErrNoVariable + return 0, err } parents, _ := t.variables.Parents(t.serviceName) for _, parent := range parents { @@ -109,7 +110,7 @@ func (t Template) replaceTag(w io.Writer, varName string) (int, error) { } break } - return 0, repo.ErrNoVariable + return 0, err } // greedyTagSplitter is a bufio.SplitFunc that reads