Skip to content
This repository has been archived by the owner on Dec 21, 2019. It is now read-only.

Commit

Permalink
refactor templater: Use resource set 'path' field when loading files
Browse files Browse the repository at this point in the history
  • Loading branch information
tazjin committed Jul 13, 2017
1 parent 7607f6d commit 5e7bb55
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions templater/templater.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const failOnMissingKeys string = "missingkey=error"
type TemplateNotFoundError struct {
meep.AllTraits
Name string
Path string
}

// Error that is caused during templating, e.g. required value being absent or invalid template format
Expand Down Expand Up @@ -64,14 +65,14 @@ func LoadAndApplyTemplates(include *[]string, exclude *[]string, c *context.Cont
func processResourceSet(c *context.Context, rs *context.ResourceSet) (*RenderedResourceSet, error) {
fmt.Fprintf(os.Stderr, "Loading resources for %s\n", rs.Name)

rp := path.Join(c.BaseDir, rs.Name)
rp := path.Join(c.BaseDir, rs.Path)
files, err := ioutil.ReadDir(rp)

resources, err := processFiles(c, rs, rp, files)

if err != nil {
return nil, meep.New(
&TemplateNotFoundError{Name: rs.Name},
&TemplateNotFoundError{Name: rs.Name, Path: rs.Path},
meep.Cause(err),
)
}
Expand Down

0 comments on commit 5e7bb55

Please sign in to comment.