Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
1d94e0f8
Commit
1d94e0f8
authored
Jun 13, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
template: abslute path for template path
parent
022a115d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
template/parse.go
template/parse.go
+8
-0
template/parse_test.go
template/parse_test.go
+2
-1
No files found.
template/parse.go
View file @
1d94e0f8
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"fmt"
"fmt"
"io"
"io"
"os"
"os"
"path/filepath"
"sort"
"sort"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/go-multierror"
...
@@ -317,6 +318,13 @@ func ParseFile(path string) (*Template, error) {
...
@@ -317,6 +318,13 @@ func ParseFile(path string) (*Template, error) {
return
nil
,
err
return
nil
,
err
}
}
if
!
filepath
.
IsAbs
(
path
)
{
path
,
err
=
filepath
.
Abs
(
path
)
if
err
!=
nil
{
return
nil
,
err
}
}
tpl
.
Path
=
path
tpl
.
Path
=
path
return
tpl
,
nil
return
tpl
,
nil
}
}
template/parse_test.go
View file @
1d94e0f8
package
template
package
template
import
(
import
(
"path/filepath"
"reflect"
"reflect"
"strings"
"strings"
"testing"
"testing"
...
@@ -306,7 +307,7 @@ func TestParse(t *testing.T) {
...
@@ -306,7 +307,7 @@ func TestParse(t *testing.T) {
}
}
for
_
,
tc
:=
range
cases
{
for
_
,
tc
:=
range
cases
{
path
:=
fixtureDir
(
tc
.
File
)
path
,
_
:=
filepath
.
Abs
(
fixtureDir
(
tc
.
File
)
)
tpl
,
err
:=
ParseFile
(
fixtureDir
(
tc
.
File
))
tpl
,
err
:=
ParseFile
(
fixtureDir
(
tc
.
File
))
if
(
err
!=
nil
)
!=
tc
.
Err
{
if
(
err
!=
nil
)
!=
tc
.
Err
{
t
.
Fatalf
(
"err: %s"
,
err
)
t
.
Fatalf
(
"err: %s"
,
err
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment