template: copy some description and min vesrion

This commit is contained in:
Mitchell Hashimoto 2015-05-21 14:41:33 -06:00
parent 839784b044
commit 43fbd26dc9
4 changed files with 26 additions and 0 deletions

View File

@ -30,6 +30,10 @@ func (r *rawTemplate) Template() (*Template, error) {
var result Template var result Template
var errs error var errs error
// Copy some literals
result.Description = r.Description
result.MinVersion = r.MinVersion
// Gather the variables // Gather the variables
if len(r.Variables) > 0 { if len(r.Variables) > 0 {
result.Variables = make(map[string]*Variable, len(r.Variables)) result.Variables = make(map[string]*Variable, len(r.Variables))

View File

@ -243,6 +243,22 @@ func TestParse(t *testing.T) {
nil, nil,
true, true,
}, },
{
"parse-description.json",
&Template{
Description: "foo",
},
false,
},
{
"parse-min-version.json",
&Template{
MinVersion: "1.2",
},
false,
},
} }
for _, tc := range cases { for _, tc := range cases {

View File

@ -0,0 +1,3 @@
{
"description": "foo"
}

View File

@ -0,0 +1,3 @@
{
"min_packer_version": "1.2"
}