2013-11-06 00:40:49 -05:00
|
|
|
package qemu
|
|
|
|
|
|
|
|
import (
|
2018-01-22 18:32:33 -05:00
|
|
|
"context"
|
2013-11-06 00:40:49 -05:00
|
|
|
"fmt"
|
2018-01-22 18:32:33 -05:00
|
|
|
"time"
|
|
|
|
|
2018-01-19 19:18:44 -05:00
|
|
|
"github.com/hashicorp/packer/helper/multistep"
|
2017-04-04 16:39:01 -04:00
|
|
|
"github.com/hashicorp/packer/packer"
|
2013-11-06 00:40:49 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// stepBootWait waits the configured time period.
|
|
|
|
type stepBootWait struct{}
|
|
|
|
|
2018-01-22 18:31:41 -05:00
|
|
|
func (s *stepBootWait) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
2015-05-27 16:39:43 -04:00
|
|
|
config := state.Get("config").(*Config)
|
2013-11-06 00:40:49 -05:00
|
|
|
ui := state.Get("ui").(packer.Ui)
|
|
|
|
|
|
|
|
if int64(config.bootWait) > 0 {
|
|
|
|
ui.Say(fmt.Sprintf("Waiting %s for boot...", config.bootWait))
|
|
|
|
time.Sleep(config.bootWait)
|
|
|
|
}
|
|
|
|
|
|
|
|
return multistep.ActionContinue
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *stepBootWait) Cleanup(state multistep.StateBag) {}
|