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
a0f1667d
Commit
a0f1667d
authored
Jul 14, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
communicator/ssh: tweakable timeout on retry connection
parent
ebd3742e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
7 deletions
+12
-7
builder/amazonebs/step_connect_ssh.go
builder/amazonebs/step_connect_ssh.go
+1
-1
builder/digitalocean/step_connect_ssh.go
builder/digitalocean/step_connect_ssh.go
+4
-1
builder/virtualbox/step_wait_for_ssh.go
builder/virtualbox/step_wait_for_ssh.go
+2
-1
builder/vmware/step_wait_for_ssh.go
builder/vmware/step_wait_for_ssh.go
+2
-1
communicator/ssh/connect.go
communicator/ssh/connect.go
+3
-3
No files found.
builder/amazonebs/step_connect_ssh.go
View file @
a0f1667d
...
...
@@ -87,7 +87,7 @@ func (s *stepConnectSSH) waitForSSH(state map[string]interface{}) (packer.Commun
// Create the function that will be used to create the connection
connFunc
:=
ssh
.
ConnectFunc
(
"tcp"
,
fmt
.
Sprintf
(
"%s:%d"
,
instance
.
DNSName
,
config
.
SSHPort
))
"tcp"
,
fmt
.
Sprintf
(
"%s:%d"
,
instance
.
DNSName
,
config
.
SSHPort
)
,
5
*
time
.
Minute
)
ui
.
Say
(
"Waiting for SSH to become available..."
)
var
comm
packer
.
Communicator
...
...
builder/digitalocean/step_connect_ssh.go
View file @
a0f1667d
...
...
@@ -32,7 +32,10 @@ func (s *stepConnectSSH) Run(state map[string]interface{}) multistep.StepAction
return
multistep
.
ActionHalt
}
connFunc
:=
ssh
.
ConnectFunc
(
"tcp"
,
fmt
.
Sprintf
(
"%s:%d"
,
ipAddress
,
config
.
SSHPort
))
connFunc
:=
ssh
.
ConnectFunc
(
"tcp"
,
fmt
.
Sprintf
(
"%s:%d"
,
ipAddress
,
config
.
SSHPort
),
5
*
time
.
Minute
)
// Build the actual SSH client configuration
sshConfig
:=
&
ssh
.
Config
{
...
...
builder/virtualbox/step_wait_for_ssh.go
View file @
a0f1667d
...
...
@@ -85,7 +85,8 @@ func (s *stepWaitForSSH) waitForSSH(state map[string]interface{}) (packer.Commun
ui
:=
state
[
"ui"
]
.
(
packer
.
Ui
)
sshHostPort
:=
state
[
"sshHostPort"
]
.
(
uint
)
connFunc
:=
ssh
.
ConnectFunc
(
"tcp"
,
fmt
.
Sprintf
(
"127.0.0.1:%d"
,
sshHostPort
))
connFunc
:=
ssh
.
ConnectFunc
(
"tcp"
,
fmt
.
Sprintf
(
"127.0.0.1:%d"
,
sshHostPort
),
5
*
time
.
Minute
)
ui
.
Say
(
"Waiting for SSH to become available..."
)
var
comm
packer
.
Communicator
...
...
builder/vmware/step_wait_for_ssh.go
View file @
a0f1667d
...
...
@@ -141,7 +141,8 @@ func (s *stepWaitForSSH) waitForSSH(state map[string]interface{}) (packer.Commun
log
.
Printf
(
"Detected IP: %s"
,
ip
)
// Attempt to connect to SSH port
connFunc
:=
ssh
.
ConnectFunc
(
"tcp"
,
fmt
.
Sprintf
(
"%s:%d"
,
ip
,
config
.
SSHPort
))
connFunc
:=
ssh
.
ConnectFunc
(
"tcp"
,
fmt
.
Sprintf
(
"%s:%d"
,
ip
,
config
.
SSHPort
),
5
*
time
.
Minute
)
nc
,
err
:=
connFunc
()
if
err
!=
nil
{
log
.
Printf
(
"TCP connection to SSH ip/port failed: %s"
,
err
)
...
...
communicator/ssh/connect.go
View file @
a0f1667d
...
...
@@ -10,13 +10,13 @@ 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
)
func
()
(
net
.
Conn
,
error
)
{
func
ConnectFunc
(
network
,
addr
string
,
timeout
time
.
Duration
)
func
()
(
net
.
Conn
,
error
)
{
return
func
()
(
net
.
Conn
,
error
)
{
timeout
:=
time
.
After
(
5
*
time
.
Minute
)
timeout
Ch
:=
time
.
After
(
timeout
)
for
{
select
{
case
<-
timeout
:
case
<-
timeout
Ch
:
return
nil
,
errors
.
New
(
"timeout connecting to remote machine"
)
default
:
}
...
...
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