builder/vmware: boot_wait is now a duration

pull/15/head
Mitchell Hashimoto 13 years ago
parent fd7d1fde70
commit 9e9196eab8

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

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

Loading…
Cancel
Save