commit
ca26ab5d5a
|
@ -3,6 +3,7 @@ package restart
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -212,20 +213,15 @@ var waitForCommunicator = func(p *Provisioner) error {
|
||||||
// provisioning before powershell is actually ready.
|
// provisioning before powershell is actually ready.
|
||||||
// In this next check, we parse stdout to make sure that the command is
|
// In this next check, we parse stdout to make sure that the command is
|
||||||
// actually running as expected.
|
// actually running as expected.
|
||||||
var stdout, stderr bytes.Buffer
|
cmdModuleLoad := &packer.RemoteCmd{Command: DefaultRestartCheckCommand}
|
||||||
cmdModuleLoad := &packer.RemoteCmd{
|
var buf, buf2 bytes.Buffer
|
||||||
Command: DefaultRestartCheckCommand,
|
cmdModuleLoad.Stdout = &buf
|
||||||
Stdin: nil,
|
cmdModuleLoad.Stdout = io.MultiWriter(cmdModuleLoad.Stdout, &buf2)
|
||||||
Stdout: &stdout,
|
|
||||||
Stderr: &stderr}
|
|
||||||
|
|
||||||
p.comm.Start(cmdModuleLoad)
|
cmdModuleLoad.StartWithUi(p.comm, p.ui)
|
||||||
cmdModuleLoad.Wait()
|
stdoutToRead := buf2.String()
|
||||||
|
|
||||||
stdoutToRead := stdout.String()
|
|
||||||
stderrToRead := stderr.String()
|
|
||||||
if !strings.Contains(stdoutToRead, "restarted.") {
|
if !strings.Contains(stdoutToRead, "restarted.") {
|
||||||
log.Printf("Stderr is %s", stderrToRead)
|
|
||||||
log.Printf("echo didn't succeed; retrying...")
|
log.Printf("echo didn't succeed; retrying...")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue