Commit 1d94e0f8 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

template: abslute path for template path

parent 022a115d
......@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"
"sort"
"github.com/hashicorp/go-multierror"
......@@ -317,6 +318,13 @@ func ParseFile(path string) (*Template, error) {
return nil, err
}
if !filepath.IsAbs(path) {
path, err = filepath.Abs(path)
if err != nil {
return nil, err
}
}
tpl.Path = path
return tpl, nil
}
package template
import (
"path/filepath"
"reflect"
"strings"
"testing"
......@@ -306,7 +307,7 @@ func TestParse(t *testing.T) {
}
for _, tc := range cases {
path := fixtureDir(tc.File)
path, _ := filepath.Abs(fixtureDir(tc.File))
tpl, err := ParseFile(fixtureDir(tc.File))
if (err != nil) != tc.Err {
t.Fatalf("err: %s", err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment