template: copy some description and min vesrion
This commit is contained in:
parent
839784b044
commit
43fbd26dc9
|
@ -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))
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"description": "foo"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"min_packer_version": "1.2"
|
||||
}
|
Loading…
Reference in New Issue