Commit a6194467 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/*: Adhere to the new interface

parent 9f5a2475
...@@ -44,10 +44,14 @@ type Builder struct { ...@@ -44,10 +44,14 @@ type Builder struct {
runner multistep.Runner runner multistep.Runner
} }
func (b *Builder) Prepare(raw interface{}) error { func (b *Builder) Prepare(raws ...interface{}) error {
err := mapstructure.Decode(raw, &b.config) var err error
if err != nil {
return err for _, raw := range raws {
err := mapstructure.Decode(raw, &b.config)
if err != nil {
return err
}
} }
if b.config.SSHPort == 0 { if b.config.SSHPort == 0 {
......
...@@ -47,10 +47,14 @@ type config struct { ...@@ -47,10 +47,14 @@ type config struct {
RawSSHWaitTimeout string `mapstructure:"ssh_wait_timeout"` RawSSHWaitTimeout string `mapstructure:"ssh_wait_timeout"`
} }
func (b *Builder) Prepare(raw interface{}) error { func (b *Builder) Prepare(raws ...interface{}) error {
var err error var err error
if err := mapstructure.Decode(raw, &b.config); err != nil {
return err for _, raw := range raws {
err := mapstructure.Decode(raw, &b.config)
if err != nil {
return err
}
} }
if b.config.GuestOSType == "" { if b.config.GuestOSType == "" {
......
...@@ -49,9 +49,12 @@ type config struct { ...@@ -49,9 +49,12 @@ type config struct {
RawSSHWaitTimeout string `mapstructure:"ssh_wait_timeout"` RawSSHWaitTimeout string `mapstructure:"ssh_wait_timeout"`
} }
func (b *Builder) Prepare(raw interface{}) error { func (b *Builder) Prepare(raws ...interface{}) error {
if err := mapstructure.Decode(raw, &b.config); err != nil { for _, raw := range raws {
return err err := mapstructure.Decode(raw, &b.config)
if err != nil {
return err
}
} }
if b.config.DiskName == "" { if b.config.DiskName == "" {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment