diff --git a/helper/communicator/config.go b/helper/communicator/config.go index 9cffb7f5f..16587f13c 100644 --- a/helper/communicator/config.go +++ b/helper/communicator/config.go @@ -41,7 +41,6 @@ type Config struct { // that uses `docker exec` and `docker cp` to execute scripts and copy // files. Type string `mapstructure:"communicator"` - // We recommend that you enable SSH or WinRM as the very last step in your // guest's bootstrap script, but sometimes you may have a race condition // where you need Packer to wait before attempting to connect to your diff --git a/helper/communicator/step_connect.go b/helper/communicator/step_connect.go index 7694e0b1a..1eaf48bf8 100644 --- a/helper/communicator/step_connect.go +++ b/helper/communicator/step_connect.go @@ -47,7 +47,6 @@ type StepConnect struct { func (s *StepConnect) pause(pauseLen time.Duration, ctx context.Context) bool { // Use a select to determine if we get cancelled during the wait - log.Printf("Pausing before connecting...") select { case <-ctx.Done(): return true @@ -112,10 +111,18 @@ func (s *StepConnect) Run(ctx context.Context, state multistep.StateBag) multist } if s.Config.PauseBeforeConnect > 0 { + ui.Say(fmt.Sprintf("Pausing %s before connecting...", + s.Config.PauseBeforeConnect.String())) cancelled := s.pause(s.Config.PauseBeforeConnect, ctx) if cancelled { return multistep.ActionHalt } + // After pause is complete, re-run the connect substep to make sure + // you've connected properly + action := s.substep.Run(ctx, state) + if action == multistep.ActionHalt { + return action + } } // Put communicator config into state so we can pass it to provisioners