github.com/angdraug/packer@v1.3.2/builder/triton/step_wait_for_stop_to_not_fail.go (about)

     1  package triton
     2  
     3  import (
     4  	"context"
     5  	"time"
     6  
     7  	"github.com/hashicorp/packer/helper/multistep"
     8  	"github.com/hashicorp/packer/packer"
     9  )
    10  
    11  // StepWaitForStopNotToFail waits for 10 seconds before returning with continue
    12  // in order to prevent an observed issue where machines stopped immediately after
    13  // they are started never actually stop.
    14  type StepWaitForStopNotToFail struct{}
    15  
    16  func (s *StepWaitForStopNotToFail) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
    17  	ui := state.Get("ui").(packer.Ui)
    18  	ui.Say("Waiting 10 seconds to avoid potential SDC bug...")
    19  	time.Sleep(10 * time.Second)
    20  	return multistep.ActionContinue
    21  }
    22  
    23  func (s *StepWaitForStopNotToFail) Cleanup(state multistep.StateBag) {
    24  	// No clean up required...
    25  }