github.com/StackPointCloud/packer@v0.10.2-0.20180716202532-b28098e0f79b/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)) + " minutes to let the action to complete...")
    22  	}
    23  	time.Sleep(time.Minute * s.Minutes)
    24  
    25  	return multistep.ActionContinue
    26  }
    27  
    28  func (s *StepSleep) Cleanup(state multistep.StateBag) {
    29  
    30  }