From d71bc34dfc1be82c9bc89dc75329c3fb7def369e Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 9 Nov 2017 11:49:12 -0800 Subject: [PATCH] don't need this in a loop --- provisioner/windows-restart/provisioner.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/provisioner/windows-restart/provisioner.go b/provisioner/windows-restart/provisioner.go index e3cb1d119..48a3cb50a 100644 --- a/provisioner/windows-restart/provisioner.go +++ b/provisioner/windows-restart/provisioner.go @@ -175,6 +175,13 @@ WaitLoop: var waitForCommunicator = func(p *Provisioner) error { runCustomRestartCheck := true + if p.config.RestartCheckCommand == DefaultRestartCheckCommand { + runCustomRestartCheck = false + } + // this is the user configurable command + cmdRestartCheck := &packer.RemoteCmd{Command: p.config.RestartCheckCommand} + log.Printf("Checking that communicator is connected with: '%s'", + cmdRestartCheck.Command) for { select { case <-p.cancel: @@ -183,16 +190,8 @@ var waitForCommunicator = func(p *Provisioner) error { case <-time.After(retryableSleep): } if runCustomRestartCheck == true { - if p.config.RestartCheckCommand == DefaultRestartCheckCommand { - runCustomRestartCheck = false - } - // this is the user configurable command - cmdRestartCheck := &packer.RemoteCmd{Command: p.config.RestartCheckCommand} - log.Printf("Checking that communicator is connected with: '%s'", - cmdRestartCheck.Command) // run user-configured restart check err := cmdRestartCheck.StartWithUi(p.comm, p.ui) - if err != nil { log.Printf("Communication connection err: %s", err) continue