Commit a6194467 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/*: Adhere to the new interface

parent 9f5a2475
...@@ -44,11 +44,15 @@ type Builder struct { ...@@ -44,11 +44,15 @@ type Builder struct {
runner multistep.Runner runner multistep.Runner
} }
func (b *Builder) Prepare(raw interface{}) error { func (b *Builder) Prepare(raws ...interface{}) error {
var err error
for _, raw := range raws {
err := mapstructure.Decode(raw, &b.config) err := mapstructure.Decode(raw, &b.config)
if err != nil { if err != nil {
return err return err
} }
}
if b.config.SSHPort == 0 { if b.config.SSHPort == 0 {
b.config.SSHPort = 22 b.config.SSHPort = 22
......
...@@ -47,11 +47,15 @@ type config struct { ...@@ -47,11 +47,15 @@ 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 {
for _, raw := range raws {
err := mapstructure.Decode(raw, &b.config)
if err != nil {
return err return err
} }
}
if b.config.GuestOSType == "" { if b.config.GuestOSType == "" {
b.config.GuestOSType = "Other" b.config.GuestOSType = "Other"
......
...@@ -49,10 +49,13 @@ type config struct { ...@@ -49,10 +49,13 @@ 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 {
err := mapstructure.Decode(raw, &b.config)
if err != nil {
return err return err
} }
}
if b.config.DiskName == "" { if b.config.DiskName == "" {
b.config.DiskName = "disk" b.config.DiskName = "disk"
......
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