Files
docker-machine/ssh/ssh.go
Darren Shepherd 8afe967a80 Fix issue where GetIP failes due to no SSH
The main goal of this patch was to make the VirtualBox driver wait for
SSH before trying to get the IP of the VM.  The generic WaitForSSH
method required a Host struct as an arg.  This patch moves most of the
logic to the driver package so that drivers can call WaitForSSH.  The
existing functions in host are just wrappers to the real
implementation in drivers now.

Signed-off-by: Darren Shepherd <darren@rancher.com>
2015-05-05 09:32:45 -07:00

23 lines
304 B
Go

package ssh
import (
"net"
"time"
"github.com/docker/machine/log"
)
func WaitForTCP(addr string) error {
for {
log.Debugf("Testing TCP connection to: %s", addr)
conn, err := net.DialTimeout("tcp", addr, 2*time.Second)
if err != nil {
continue
}
defer conn.Close()
return nil
}
}