Commit 67eaa07c authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer: Get rid of "name" in template, wasn't used for anything

parent d8cdc88c
...@@ -11,7 +11,6 @@ import ( ...@@ -11,7 +11,6 @@ import (
// "interface{}" pointers since we actually don't know what their contents // "interface{}" pointers since we actually don't know what their contents
// are until we read the "type" field. // are until we read the "type" field.
type rawTemplate struct { type rawTemplate struct {
Name string
Builders []map[string]interface{} Builders []map[string]interface{}
Hooks map[string][]string Hooks map[string][]string
Provisioners []map[string]interface{} Provisioners []map[string]interface{}
...@@ -21,7 +20,6 @@ type rawTemplate struct { ...@@ -21,7 +20,6 @@ type rawTemplate struct {
// The Template struct represents a parsed template, parsed into the most // The Template struct represents a parsed template, parsed into the most
// completed form it can be without additional processing by the caller. // completed form it can be without additional processing by the caller.
type Template struct { type Template struct {
Name string
Builders map[string]rawBuilderConfig Builders map[string]rawBuilderConfig
Hooks map[string][]string Hooks map[string][]string
Provisioners []rawProvisionerConfig Provisioners []rawProvisionerConfig
...@@ -61,7 +59,6 @@ func ParseTemplate(data []byte) (t *Template, err error) { ...@@ -61,7 +59,6 @@ func ParseTemplate(data []byte) (t *Template, err error) {
} }
t = &Template{} t = &Template{}
t.Name = rawTpl.Name
t.Builders = make(map[string]rawBuilderConfig) t.Builders = make(map[string]rawBuilderConfig)
t.Hooks = rawTpl.Hooks t.Hooks = rawTpl.Hooks
t.Provisioners = make([]rawProvisionerConfig, len(rawTpl.Provisioners)) t.Provisioners = make([]rawProvisionerConfig, len(rawTpl.Provisioners))
......
...@@ -11,7 +11,6 @@ func TestParseTemplate_Basic(t *testing.T) { ...@@ -11,7 +11,6 @@ func TestParseTemplate_Basic(t *testing.T) {
data := ` data := `
{ {
"name": "my-image",
"builders": [] "builders": []
} }
` `
...@@ -19,7 +18,6 @@ func TestParseTemplate_Basic(t *testing.T) { ...@@ -19,7 +18,6 @@ func TestParseTemplate_Basic(t *testing.T) {
result, err := ParseTemplate([]byte(data)) result, err := ParseTemplate([]byte(data))
assert.Nil(err, "should not error") assert.Nil(err, "should not error")
assert.NotNil(result, "template should not be nil") assert.NotNil(result, "template should not be nil")
assert.Equal(result.Name, "my-image", "name should be correct")
assert.Length(result.Builders, 0, "no builders") assert.Length(result.Builders, 0, "no builders")
} }
......
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