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
c58d5ab3
Commit
c58d5ab3
authored
Jun 12, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: time out on SSH handshake for retry
parent
5c0d8ecd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
builder/virtualbox/builder_test.go
builder/virtualbox/builder_test.go
+2
-2
builder/virtualbox/step_wait_for_ssh.go
builder/virtualbox/step_wait_for_ssh.go
+19
-4
No files found.
builder/virtualbox/builder_test.go
View file @
c58d5ab3
...
...
@@ -9,8 +9,8 @@ import (
func
testConfig
()
map
[
string
]
interface
{}
{
return
map
[
string
]
interface
{}{
"iso_md5"
:
"foo"
,
"iso_url"
:
"http://www.google.com/"
,
"iso_md5"
:
"foo"
,
"iso_url"
:
"http://www.google.com/"
,
"ssh_username"
:
"foo"
,
}
}
...
...
builder/virtualbox/step_wait_for_ssh.go
View file @
c58d5ab3
...
...
@@ -115,10 +115,25 @@ func (s *stepWaitForSSH) waitForSSH(state map[string]interface{}) (packer.Commun
},
}
comm
,
err
=
ssh
.
New
(
nc
,
sshConfig
)
if
err
!=
nil
{
log
.
Printf
(
"SSH connection fail: %s"
,
err
)
nc
.
Close
()
sshConnectSuccess
:=
make
(
chan
bool
,
1
)
go
func
()
{
comm
,
err
=
ssh
.
New
(
nc
,
sshConfig
)
if
err
!=
nil
{
log
.
Printf
(
"SSH connection fail: %s"
,
err
)
sshConnectSuccess
<-
false
return
}
sshConnectSuccess
<-
true
}()
select
{
case
success
:=
<-
sshConnectSuccess
:
if
!
success
{
continue
}
case
<-
time
.
After
(
5
*
time
.
Second
)
:
log
.
Printf
(
"SSH handshake timeout. Trying again."
)
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