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
2b9e52e7
Commit
2b9e52e7
authored
May 29, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
template: stores the path
parent
2752e51e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
template/parse.go
template/parse.go
+7
-1
template/parse_test.go
template/parse_test.go
+4
-0
template/template.go
template/template.go
+4
-0
No files found.
template/parse.go
View file @
2b9e52e7
...
...
@@ -310,5 +310,11 @@ func ParseFile(path string) (*Template, error) {
}
defer
f
.
Close
()
return
Parse
(
f
)
tpl
,
err
:=
Parse
(
f
)
if
err
!=
nil
{
return
nil
,
err
}
tpl
.
Path
=
path
return
tpl
,
nil
}
template/parse_test.go
View file @
2b9e52e7
...
...
@@ -272,11 +272,15 @@ func TestParse(t *testing.T) {
}
for
_
,
tc
:=
range
cases
{
path
:=
fixtureDir
(
tc
.
File
)
tpl
,
err
:=
ParseFile
(
fixtureDir
(
tc
.
File
))
if
(
err
!=
nil
)
!=
tc
.
Err
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
if
tc
.
Result
!=
nil
{
tc
.
Result
.
Path
=
path
}
if
tpl
!=
nil
{
tpl
.
RawContents
=
nil
}
...
...
template/template.go
View file @
2b9e52e7
...
...
@@ -11,6 +11,10 @@ import (
// Template represents the parsed template that is used to configure
// Packer builds.
type
Template
struct
{
// Path is the path to the template. This will be blank if Parse is
// used, but will be automatically populated by ParseFile.
Path
string
Description
string
MinVersion
string
...
...
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