move pause to after connection can be established.
This commit is contained in:
parent
b8510f35fc
commit
9db844a807
|
@ -60,13 +60,6 @@ func (s *StepConnect) pause(pauseLen time.Duration, ctx context.Context) bool {
|
||||||
func (s *StepConnect) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepConnect) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packer.Ui)
|
||||||
|
|
||||||
if s.Config.PauseBeforeConnect > 0 {
|
|
||||||
cancelled := s.pause(s.Config.PauseBeforeConnect, ctx)
|
|
||||||
if cancelled {
|
|
||||||
return multistep.ActionHalt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typeMap := map[string]multistep.Step{
|
typeMap := map[string]multistep.Step{
|
||||||
"none": nil,
|
"none": nil,
|
||||||
"ssh": &StepConnectSSH{
|
"ssh": &StepConnectSSH{
|
||||||
|
@ -114,7 +107,19 @@ func (s *StepConnect) Run(ctx context.Context, state multistep.StateBag) multist
|
||||||
}
|
}
|
||||||
|
|
||||||
s.substep = step
|
s.substep = step
|
||||||
return s.substep.Run(ctx, state)
|
action := s.substep.Run(ctx, state)
|
||||||
|
if action == multistep.ActionHalt {
|
||||||
|
return action
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.Config.PauseBeforeConnect > 0 {
|
||||||
|
cancelled := s.pause(s.Config.PauseBeforeConnect, ctx)
|
||||||
|
if cancelled {
|
||||||
|
return multistep.ActionHalt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return multistep.ActionContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepConnect) Cleanup(state multistep.StateBag) {
|
func (s *StepConnect) Cleanup(state multistep.StateBag) {
|
||||||
|
|
Loading…
Reference in New Issue