diff --git a/template/parse.go b/template/parse.go index df29e8af0..c0e21b1c4 100644 --- a/template/parse.go +++ b/template/parse.go @@ -174,6 +174,17 @@ func (r *rawTemplate) Template() (*Template, error) { result.Provisioners = append(result.Provisioners, &p) } + // Push + if len(r.Push) > 0 { + var p Push + if err := r.decoder(&p, nil).Decode(r.Push); err != nil { + errs = multierror.Append(errs, fmt.Errorf( + "push: %s", err)) + } + + result.Push = &p + } + // If we have errors, return those with a nil result if errs != nil { return nil, errs diff --git a/template/parse_test.go b/template/parse_test.go index 3e6847604..023c3d537 100644 --- a/template/parse_test.go +++ b/template/parse_test.go @@ -259,6 +259,16 @@ func TestParse(t *testing.T) { }, false, }, + + { + "parse-push.json", + &Template{ + Push: &Push{ + Name: "foo", + }, + }, + false, + }, } for _, tc := range cases { diff --git a/template/test-fixtures/parse-push.json b/template/test-fixtures/parse-push.json new file mode 100644 index 000000000..2529eedc4 --- /dev/null +++ b/template/test-fixtures/parse-push.json @@ -0,0 +1,5 @@ +{ + "push": { + "name": "foo" + } +}