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
8d0904e2
Commit
8d0904e2
authored
Jun 13, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
helper/communicator: configurable handshake attempts [GH-1988]
parent
a832e126
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
helper/communicator/config.go
helper/communicator/config.go
+13
-8
helper/communicator/step_connect_ssh.go
helper/communicator/step_connect_ssh.go
+4
-2
No files found.
helper/communicator/config.go
View file @
8d0904e2
...
...
@@ -20,6 +20,7 @@ type Config struct {
SSHPrivateKey
string
`mapstructure:"ssh_private_key_file"`
SSHPty
bool
`mapstructure:"ssh_pty"`
SSHTimeout
time
.
Duration
`mapstructure:"ssh_timeout"`
SSHHandshakeAttempts
int
`mapstructure:"ssh_handshake_attempts"`
}
func
(
c
*
Config
)
Prepare
(
ctx
*
interpolate
.
Context
)
[]
error
{
...
...
@@ -35,6 +36,10 @@ func (c *Config) Prepare(ctx *interpolate.Context) []error {
c
.
SSHTimeout
=
5
*
time
.
Minute
}
if
c
.
SSHHandshakeAttempts
==
0
{
c
.
SSHHandshakeAttempts
=
10
}
// Validation
var
errs
[]
error
if
c
.
Type
==
"ssh"
{
...
...
helper/communicator/step_connect_ssh.go
View file @
8d0904e2
...
...
@@ -149,8 +149,10 @@ func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, cancel <-chan stru
handshakeAttempts
+=
1
}
if
handshakeAttempts
<
10
{
// Try to connect via SSH a handful of times
if
handshakeAttempts
<
s
.
Config
.
SSHHandshakeAttempts
{
// Try to connect via SSH a handful of times. We sleep here
// so we don't get a ton of authentication errors back to back.
time
.
Sleep
(
2
*
time
.
Second
)
continue
}
...
...
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