Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
cf175b47
Commit
cf175b47
authored
Aug 22, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
communicator/ssh: respect interrupts by not looping on retyr [GH-327]
parent
c0d19460
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
20 deletions
+5
-20
CHANGELOG.md
CHANGELOG.md
+1
-0
common/step_connect_ssh.go
common/step_connect_ssh.go
+1
-1
communicator/ssh/connect.go
communicator/ssh/connect.go
+3
-19
No files found.
CHANGELOG.md
View file @
cf175b47
...
...
@@ -2,6 +2,7 @@
BUG FIXES:
*
core: Fixed a couple cases where a double ctrl-C could panic.
*
command/build,command/validate: If a non-existent build is specified to
'-only' or '-except', it is now an error. [GH-326]
...
...
common/step_connect_ssh.go
View file @
cf175b47
...
...
@@ -116,7 +116,7 @@ func (s *StepConnectSSH) waitForSSH(state map[string]interface{}, cancel <-chan
}
// Attempt to connect to SSH port
connFunc
:=
ssh
.
ConnectFunc
(
"tcp"
,
address
,
5
*
time
.
Minute
)
connFunc
:=
ssh
.
ConnectFunc
(
"tcp"
,
address
)
nc
,
err
:=
connFunc
()
if
err
!=
nil
{
log
.
Printf
(
"TCP connection to SSH ip/port failed: %s"
,
err
)
...
...
communicator/ssh/connect.go
View file @
cf175b47
package
ssh
import
(
"errors"
"log"
"net"
"time"
...
...
@@ -10,24 +9,9 @@ import (
// ConnectFunc is a convenience method for returning a function
// that just uses net.Dial to communicate with the remote end that
// is suitable for use with the SSH communicator configuration.
func
ConnectFunc
(
network
,
addr
string
,
timeout
time
.
Duration
)
func
()
(
net
.
Conn
,
error
)
{
func
ConnectFunc
(
network
,
addr
string
)
func
()
(
net
.
Conn
,
error
)
{
return
func
()
(
net
.
Conn
,
error
)
{
timeoutCh
:=
time
.
After
(
timeout
)
for
{
select
{
case
<-
timeoutCh
:
return
nil
,
errors
.
New
(
"timeout connecting to remote machine"
)
default
:
}
log
.
Printf
(
"Opening conn for SSH to %s %s"
,
network
,
addr
)
nc
,
err
:=
net
.
DialTimeout
(
network
,
addr
,
15
*
time
.
Second
)
if
err
==
nil
{
return
nc
,
nil
}
time
.
Sleep
(
500
*
time
.
Millisecond
)
}
log
.
Printf
(
"Opening conn for SSH to %s %s"
,
network
,
addr
)
return
net
.
DialTimeout
(
network
,
addr
,
15
*
time
.
Second
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment