packer-plugin-xenserver/builder/xenserver/step_boot_wait.go
Rob Dobson 4d634aaf70 Initial plugin for building XenServer images using Packer.IO
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2014-11-10 18:16:02 +00:00

31 lines
786 B
Go

package xenserver
import (
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"time"
)
type stepBootWait struct{}
func (self *stepBootWait) Run(state multistep.StateBag) multistep.StepAction {
client := state.Get("client").(XenAPIClient)
config := state.Get("config").(config)
ui := state.Get("ui").(packer.Ui)
instance, _ := client.GetVMByUuid(state.Get("instance_uuid").(string))
ui.Say("Unpausing VM " + state.Get("instance_uuid").(string))
instance.Unpause()
if int64(config.BootWait) > 0 {
ui.Say(fmt.Sprintf("Waiting %s for boot...", config.BootWait))
time.Sleep(config.BootWait)
}
return multistep.ActionContinue
}
func (self *stepBootWait) Cleanup(state multistep.StateBag) {}