Commit 42e9e734 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

common: don't wait SSH on first try

parent b765b9ce
...@@ -4,11 +4,10 @@ FEATURES: ...@@ -4,11 +4,10 @@ FEATURES:
* builder/vmware: VMware Fusion Pro 7 is now supported. [GH-1478] * builder/vmware: VMware Fusion Pro 7 is now supported. [GH-1478]
IMPROVEMENTS:
BUG FIXES: BUG FIXES:
* build scripts: Windows executable renamed to packer.exe. [GH-1483] * core: SSH will connect slightly faster if it is ready immediately.
* scripts: Windows executable renamed to packer.exe. [GH-1483]
## 0.7.0 (September 8, 2014) ## 0.7.0 (September 8, 2014)
......
...@@ -98,13 +98,18 @@ func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, cancel <-chan stru ...@@ -98,13 +98,18 @@ func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, cancel <-chan stru
handshakeAttempts := 0 handshakeAttempts := 0
var comm packer.Communicator var comm packer.Communicator
first := true
for { for {
// Don't check for cancel or wait on first iteration
if !first {
select { select {
case <-cancel: case <-cancel:
log.Println("SSH wait cancelled. Exiting loop.") log.Println("SSH wait cancelled. Exiting loop.")
return nil, errors.New("SSH wait cancelled") return nil, errors.New("SSH wait cancelled")
case <-time.After(5 * time.Second): case <-time.After(5 * time.Second):
} }
}
first = false
// First we request the TCP connection information // First we request the TCP connection information
address, err := s.SSHAddress(state) address, err := s.SSHAddress(state)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment