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
6c19ba62
Commit
6c19ba62
authored
Nov 04, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: no panic if ssh host port min/max is same [GH-594]
parent
b330bfd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
CHANGELOG.md
CHANGELOG.md
+1
-0
builder/virtualbox/step_forward_ssh.go
builder/virtualbox/step_forward_ssh.go
+8
-1
No files found.
CHANGELOG.md
View file @
6c19ba62
...
...
@@ -21,6 +21,7 @@ BUG FIXES:
*
builder/amazon/all: Properly scrub access key and secret key from logs.
[GH-554]
*
builder/openstack: Properly scrub password from logs [GH-554]
*
builder/virtualbox: No panic if SSH host port min/max is the same. [GH-594]
*
common/uuid: Use cryptographically secure PRNG when generating
UUIDs. [GH-552]
*
communicator/ssh: File uploads that exceed the size of memory no longer
...
...
builder/virtualbox/step_forward_ssh.go
View file @
6c19ba62
...
...
@@ -25,9 +25,16 @@ func (s *stepForwardSSH) Run(state multistep.StateBag) multistep.StepAction {
log
.
Printf
(
"Looking for available SSH port between %d and %d"
,
config
.
SSHHostPortMin
,
config
.
SSHHostPortMax
)
var
sshHostPort
uint
var
offset
uint
=
0
portRange
:=
int
(
config
.
SSHHostPortMax
-
config
.
SSHHostPortMin
)
if
portRange
>
0
{
// Have to check if > 0 to avoid a panic
offset
=
uint
(
rand
.
Intn
(
portRange
))
}
for
{
sshHostPort
=
uint
(
rand
.
Intn
(
portRange
))
+
config
.
SSHHostPortMin
sshHostPort
=
offset
+
config
.
SSHHostPortMin
log
.
Printf
(
"Trying port: %d"
,
sshHostPort
)
l
,
err
:=
net
.
Listen
(
"tcp"
,
fmt
.
Sprintf
(
":%d"
,
sshHostPort
))
if
err
==
nil
{
...
...
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