Commit 06b0cebd authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer: Template properly calls builder type builderType

parent 4bd7db07
......@@ -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 {
builderName string
builderType 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.builderName)
builder, err := components.Builder(builderConfig.builderType)
if err != nil {
return
}
if builder == nil {
err = fmt.Errorf("Builder not found: %s", name)
err = fmt.Errorf("Builder type not found: %s", builderConfig.builderType)
return
}
......
......@@ -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.builderName, "amazon-ebs", "builder should be amazon-ebs")
assert.Equal(builder.builderType, "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.builderName, "amazon-ebs", "builder should be amazon-ebs")
assert.Equal(builder.builderType, "amazon-ebs", "builder should be amazon-ebs")
}
func TestParseTemplate_BuilderWithConflictingName(t *testing.T) {
......
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