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
06b0cebd
Commit
06b0cebd
authored
May 22, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: Template properly calls builder type builderType
parent
4bd7db07
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
packer/template.go
packer/template.go
+7
-4
packer/template_test.go
packer/template_test.go
+2
-2
No files found.
packer/template.go
View file @
06b0cebd
...
...
@@ -30,7 +30,7 @@ type Template struct {
// raw configuration. If requested, this is used to compile into a full
// builder configuration at some point.
type
rawBuilderConfig
struct
{
builder
Nam
e
string
builder
Typ
e
string
rawConfig
interface
{}
}
...
...
@@ -88,7 +88,10 @@ func ParseTemplate(data []byte) (t *Template, err error) {
continue
}
t
.
Builders
[
name
]
=
rawBuilderConfig
{
typeName
,
v
}
t
.
Builders
[
name
]
=
rawBuilderConfig
{
typeName
,
v
,
}
}
// If there were errors, we put it into a MultiError and return
...
...
@@ -122,13 +125,13 @@ func (t *Template) Build(name string, components *ComponentFinder) (b Build, err
return
}
builder
,
err
:=
components
.
Builder
(
builderConfig
.
builder
Nam
e
)
builder
,
err
:=
components
.
Builder
(
builderConfig
.
builder
Typ
e
)
if
err
!=
nil
{
return
}
if
builder
==
nil
{
err
=
fmt
.
Errorf
(
"Builder
not found: %s"
,
nam
e
)
err
=
fmt
.
Errorf
(
"Builder
type not found: %s"
,
builderConfig
.
builderTyp
e
)
return
}
...
...
packer/template_test.go
View file @
06b0cebd
...
...
@@ -91,7 +91,7 @@ func TestParseTemplate_BuilderWithoutName(t *testing.T) {
builder
,
ok
:=
result
.
Builders
[
"amazon-ebs"
]
assert
.
True
(
ok
,
"should have amazon-ebs builder"
)
assert
.
Equal
(
builder
.
builder
Nam
e
,
"amazon-ebs"
,
"builder should be amazon-ebs"
)
assert
.
Equal
(
builder
.
builder
Typ
e
,
"amazon-ebs"
,
"builder should be amazon-ebs"
)
}
func
TestParseTemplate_BuilderWithName
(
t
*
testing
.
T
)
{
...
...
@@ -116,7 +116,7 @@ func TestParseTemplate_BuilderWithName(t *testing.T) {
builder
,
ok
:=
result
.
Builders
[
"bob"
]
assert
.
True
(
ok
,
"should have bob builder"
)
assert
.
Equal
(
builder
.
builder
Nam
e
,
"amazon-ebs"
,
"builder should be amazon-ebs"
)
assert
.
Equal
(
builder
.
builder
Typ
e
,
"amazon-ebs"
,
"builder should be amazon-ebs"
)
}
func
TestParseTemplate_BuilderWithConflictingName
(
t
*
testing
.
T
)
{
...
...
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