diff --git a/builder/vmware/builder.go b/builder/vmware/builder.go index 90bebbe73..ef3298cff 100644 --- a/builder/vmware/builder.go +++ b/builder/vmware/builder.go @@ -22,11 +22,12 @@ type config struct { OutputDir string `mapstructure:"output_directory"` HTTPDir string `mapstructure:"http_directory"` BootCommand []string `mapstructure:"boot_command"` - BootWait uint `mapstructure:"boot_wait"` - SSHUser string `mapstructure:"ssh_user"` - SSHPassword string `mapstructure:"ssh_password"` + BootWait time.Duration + SSHUser string `mapstructure:"ssh_user"` + SSHPassword string `mapstructure:"ssh_password"` SSHWaitTimeout time.Duration + RawBootWait string `mapstructure:"boot_wait"` RawSSHWaitTimeout string `mapstructure:"ssh_wait_timeout"` } @@ -48,6 +49,13 @@ func (b *Builder) Prepare(raw interface{}) (err error) { b.config.OutputDir = "vmware" } + if b.config.RawBootWait != "" { + b.config.BootWait, err = time.ParseDuration(b.config.RawBootWait) + if err != nil { + return + } + } + if b.config.RawSSHWaitTimeout == "" { b.config.RawSSHWaitTimeout = "20m" } diff --git a/builder/vmware/step_run.go b/builder/vmware/step_run.go index 7dc096a88..c8c596ccb 100644 --- a/builder/vmware/step_run.go +++ b/builder/vmware/step_run.go @@ -41,9 +41,9 @@ func (s *stepRun) Run(state map[string]interface{}) multistep.StepAction { } // Wait the wait amount - if config.BootWait > 0 { - ui.Say(fmt.Sprintf("Waiting %d seconds for boot...", config.BootWait)) - time.Sleep(time.Duration(config.BootWait) * time.Second) + if int64(config.BootWait) > 0 { + ui.Say(fmt.Sprintf("Waiting %s for boot...", config.BootWait.String())) + time.Sleep(config.BootWait) } return multistep.ActionContinue