Skip to content

Commit

Permalink
template: copy some description and min vesrion
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed May 21, 2015
1 parent 839784b commit 43fbd26
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions template/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ func (r *rawTemplate) Template() (*Template, error) {
var result Template
var errs error

// Copy some literals
result.Description = r.Description
result.MinVersion = r.MinVersion

// Gather the variables
if len(r.Variables) > 0 {
result.Variables = make(map[string]*Variable, len(r.Variables))
Expand Down
16 changes: 16 additions & 0 deletions template/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,22 @@ func TestParse(t *testing.T) {
nil,
true,
},

{
"parse-description.json",
&Template{
Description: "foo",
},
false,
},

{
"parse-min-version.json",
&Template{
MinVersion: "1.2",
},
false,
},
}

for _, tc := range cases {
Expand Down
3 changes: 3 additions & 0 deletions template/test-fixtures/parse-description.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"description": "foo"
}
3 changes: 3 additions & 0 deletions template/test-fixtures/parse-min-version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"min_packer_version": "1.2"
}

0 comments on commit 43fbd26

Please sign in to comment.