github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/builder/hyperv/common/step_sleep.go (about)

     1  package common
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/mitchellh/multistep"
     6  	"github.com/mitchellh/packer/packer"
     7  	"time"
     8  )
     9  
    10  type StepSleep struct {
    11  	Minutes    time.Duration
    12  	ActionName string
    13  }
    14  
    15  func (s *StepSleep) Run(state multistep.StateBag) multistep.StepAction {
    16  	ui := state.Get("ui").(packer.Ui)
    17  
    18  	if len(s.ActionName) > 0 {
    19  		ui.Say(s.ActionName + "! Waiting for " + fmt.Sprintf("%v", uint(s.Minutes)) + " minutes to let the action to complete...")
    20  	}
    21  	time.Sleep(time.Minute * s.Minutes)
    22  
    23  	return multistep.ActionContinue
    24  }
    25  
    26  func (s *StepSleep) Cleanup(state multistep.StateBag) {
    27  
    28  }