From 43fbd26dc91a4d78897e3b8845b5b2e00937b47e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 21 May 2015 14:41:33 -0600 Subject: [PATCH] template: copy some description and min vesrion --- template/parse.go | 4 ++++ template/parse_test.go | 16 ++++++++++++++++ template/test-fixtures/parse-description.json | 3 +++ template/test-fixtures/parse-min-version.json | 3 +++ 4 files changed, 26 insertions(+) create mode 100644 template/test-fixtures/parse-description.json create mode 100644 template/test-fixtures/parse-min-version.json diff --git a/template/parse.go b/template/parse.go index f9dc7cba3..df29e8af0 100644 --- a/template/parse.go +++ b/template/parse.go @@ -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)) diff --git a/template/parse_test.go b/template/parse_test.go index b28670e40..3e6847604 100644 --- a/template/parse_test.go +++ b/template/parse_test.go @@ -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 { diff --git a/template/test-fixtures/parse-description.json b/template/test-fixtures/parse-description.json new file mode 100644 index 000000000..c72a24eb8 --- /dev/null +++ b/template/test-fixtures/parse-description.json @@ -0,0 +1,3 @@ +{ + "description": "foo" +} diff --git a/template/test-fixtures/parse-min-version.json b/template/test-fixtures/parse-min-version.json new file mode 100644 index 000000000..f98101efb --- /dev/null +++ b/template/test-fixtures/parse-min-version.json @@ -0,0 +1,3 @@ +{ + "min_packer_version": "1.2" +}