Commit 9e9196ea authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/vmware: boot_wait is now a duration

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