From c75b4555ccd22859bc4eb1643c01293c745b190d Mon Sep 17 00:00:00 2001 From: Cheng Sun Date: Tue, 9 Dec 2014 14:56:21 +0000 Subject: [PATCH] Make boot_wait interruptible --- builder/xenserver/step_boot_wait.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/builder/xenserver/step_boot_wait.go b/builder/xenserver/step_boot_wait.go index 58f8126..4978619 100644 --- a/builder/xenserver/step_boot_wait.go +++ b/builder/xenserver/step_boot_wait.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" - "time" ) type stepBootWait struct{} @@ -20,7 +19,11 @@ func (self *stepBootWait) Run(state multistep.StateBag) multistep.StepAction { if int64(config.BootWait) > 0 { ui.Say(fmt.Sprintf("Waiting %s for boot...", config.BootWait)) - time.Sleep(config.BootWait) + err := InterruptibleWait{Timeout: config.BootWait}.Wait(state) + if err != nil { + ui.Error(err.Error()) + return multistep.ActionHalt + } } return multistep.ActionContinue }