github.com/sneal/packer@v0.5.2/builder/qemu/step_boot_wait.go (about)

     1  package qemu
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/mitchellh/multistep"
     6  	"github.com/mitchellh/packer/packer"
     7  	"time"
     8  )
     9  
    10  // stepBootWait waits the configured time period.
    11  type stepBootWait struct{}
    12  
    13  func (s *stepBootWait) Run(state multistep.StateBag) multistep.StepAction {
    14  	config := state.Get("config").(*config)
    15  	ui := state.Get("ui").(packer.Ui)
    16  
    17  	if int64(config.bootWait) > 0 {
    18  		ui.Say(fmt.Sprintf("Waiting %s for boot...", config.bootWait))
    19  		time.Sleep(config.bootWait)
    20  	}
    21  
    22  	return multistep.ActionContinue
    23  }
    24  
    25  func (s *stepBootWait) Cleanup(state multistep.StateBag) {}