template: parse push

This commit is contained in:
Mitchell Hashimoto 2015-05-21 14:44:29 -06:00
parent 43fbd26dc9
commit 2e4dd63912
3 changed files with 26 additions and 0 deletions

View File

@ -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

View File

@ -259,6 +259,16 @@ func TestParse(t *testing.T) {
},
false,
},
{
"parse-push.json",
&Template{
Push: &Push{
Name: "foo",
},
},
false,
},
}
for _, tc := range cases {

View File

@ -0,0 +1,5 @@
{
"push": {
"name": "foo"
}
}