Skip to content

Commit

Permalink
installer/template.go: Do not override the error if no variable is found
Browse files Browse the repository at this point in the history
  • Loading branch information
livingsilver94 committed Nov 26, 2023
1 parent 5311a92 commit 991b6bb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions installer/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down

0 comments on commit 991b6bb

Please sign in to comment.