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