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
25533336
Commit
25533336
authored
Jun 18, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ldx-master'
parents
fd40b714
ba2cf184
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
builder/qemu/step_forward_ssh.go
builder/qemu/step_forward_ssh.go
+5
-0
builder/virtualbox/common/step_forward_ssh.go
builder/virtualbox/common/step_forward_ssh.go
+6
-1
No files found.
builder/qemu/step_forward_ssh.go
View file @
25533336
...
@@ -34,12 +34,17 @@ func (s *stepForwardSSH) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -34,12 +34,17 @@ func (s *stepForwardSSH) Run(state multistep.StateBag) multistep.StepAction {
for
{
for
{
sshHostPort
=
offset
+
config
.
SSHHostPortMin
sshHostPort
=
offset
+
config
.
SSHHostPortMin
if
sshHostPort
>=
config
.
SSHHostPortMax
{
offset
=
0
sshHostPort
=
config
.
SSHHostPortMin
}
log
.
Printf
(
"Trying port: %d"
,
sshHostPort
)
log
.
Printf
(
"Trying port: %d"
,
sshHostPort
)
l
,
err
:=
net
.
Listen
(
"tcp"
,
fmt
.
Sprintf
(
":%d"
,
sshHostPort
))
l
,
err
:=
net
.
Listen
(
"tcp"
,
fmt
.
Sprintf
(
":%d"
,
sshHostPort
))
if
err
==
nil
{
if
err
==
nil
{
defer
l
.
Close
()
defer
l
.
Close
()
break
break
}
}
offset
++
}
}
ui
.
Say
(
fmt
.
Sprintf
(
"Found port for SSH: %d."
,
sshHostPort
))
ui
.
Say
(
fmt
.
Sprintf
(
"Found port for SSH: %d."
,
sshHostPort
))
...
...
builder/virtualbox/common/step_forward_ssh.go
View file @
25533336
...
@@ -46,13 +46,18 @@ func (s *StepForwardSSH) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -46,13 +46,18 @@ func (s *StepForwardSSH) Run(state multistep.StateBag) multistep.StepAction {
}
}
for
{
for
{
sshHostPort
=
offset
+
int
(
s
.
HostPortMin
)
sshHostPort
=
offset
+
s
.
HostPortMin
if
sshHostPort
>=
s
.
HostPortMax
{
offset
=
0
sshHostPort
=
s
.
HostPortMin
}
log
.
Printf
(
"Trying port: %d"
,
sshHostPort
)
log
.
Printf
(
"Trying port: %d"
,
sshHostPort
)
l
,
err
:=
net
.
Listen
(
"tcp"
,
fmt
.
Sprintf
(
"127.0.0.1:%d"
,
sshHostPort
))
l
,
err
:=
net
.
Listen
(
"tcp"
,
fmt
.
Sprintf
(
"127.0.0.1:%d"
,
sshHostPort
))
if
err
==
nil
{
if
err
==
nil
{
defer
l
.
Close
()
defer
l
.
Close
()
break
break
}
}
offset
++
}
}
// Create a forwarded port mapping to the VM
// Create a forwarded port mapping to the VM
...
...
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