builder/digitalocean: timeout TCP connections to SSH

This commit is contained in:
Mitchell Hashimoto 2013-06-19 13:26:08 -07:00
parent b78fd17a0a
commit 867e9d1c8f
1 changed files with 4 additions and 1 deletions

View File

@ -61,7 +61,10 @@ func (s *stepConnectSSH) Run(state map[string]interface{}) multistep.StepAction
log.Printf(
"Opening TCP conn for SSH to %s:%d (attempt %d)",
ipAddress, config.SSHPort, attempts)
s.conn, err = net.Dial("tcp", fmt.Sprintf("%s:%d", ipAddress, config.SSHPort))
s.conn, err = net.DialTimeout(
"tcp",
fmt.Sprintf("%s:%d", ipAddress, config.SSHPort),
10*time.Second)
if err == nil {
break
}