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
2c41d59e
Commit
2c41d59e
authored
Aug 18, 2014
by
Jason A. Beranek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vmware-iso: Update VNCAddressFinder interface to return errors from VNCAddress()
parent
6acbc91f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
builder/vmware/iso/driver_esx5.go
builder/vmware/iso/driver_esx5.go
+8
-2
builder/vmware/iso/step_configure_vnc.go
builder/vmware/iso/step_configure_vnc.go
+5
-7
No files found.
builder/vmware/iso/driver_esx5.go
View file @
2c41d59e
...
...
@@ -148,7 +148,7 @@ func (d *ESX5Driver) HostIP() (string, error) {
return
host
,
err
}
func
(
d
*
ESX5Driver
)
VNCAddress
(
portMin
,
portMax
uint
)
(
string
,
uint
)
{
func
(
d
*
ESX5Driver
)
VNCAddress
(
portMin
,
portMax
uint
)
(
string
,
uint
,
error
)
{
var
vncPort
uint
// TODO(dougm) use esxcli network ip connection list
for
port
:=
portMin
;
port
<=
portMax
;
port
++
{
...
...
@@ -170,7 +170,13 @@ func (d *ESX5Driver) VNCAddress(portMin, portMax uint) (string, uint) {
}
}
return
d
.
Host
,
vncPort
if
vncPort
==
0
{
err
:=
fmt
.
Errorf
(
"Unable to find available VNC port between %d and %d"
,
portMin
,
portMax
)
return
d
.
Host
,
vncPort
,
err
}
return
d
.
Host
,
vncPort
,
nil
}
func
(
d
*
ESX5Driver
)
SSHAddress
(
state
multistep
.
StateBag
)
(
string
,
error
)
{
...
...
builder/vmware/iso/step_configure_vnc.go
View file @
2c41d59e
...
...
@@ -24,10 +24,10 @@ import (
type
stepConfigureVNC
struct
{}
type
VNCAddressFinder
interface
{
VNCAddress
(
uint
,
uint
)
(
string
,
uint
)
VNCAddress
(
uint
,
uint
)
(
string
,
uint
,
error
)
}
func
(
stepConfigureVNC
)
VNCAddress
(
portMin
,
portMax
uint
)
(
string
,
uint
)
{
func
(
stepConfigureVNC
)
VNCAddress
(
portMin
,
portMax
uint
)
(
string
,
uint
,
error
)
{
// Find an open VNC port. Note that this can still fail later on
// because we have to release the port at some point. But this does its
// best.
...
...
@@ -47,7 +47,7 @@ func (stepConfigureVNC) VNCAddress(portMin, portMax uint) (string, uint) {
break
}
}
return
"127.0.0.1"
,
vncPort
return
"127.0.0.1"
,
vncPort
,
nil
}
func
(
s
*
stepConfigureVNC
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
...
...
@@ -79,10 +79,8 @@ func (s *stepConfigureVNC) Run(state multistep.StateBag) multistep.StepAction {
vncFinder
=
s
}
log
.
Printf
(
"Looking for available port between %d and %d"
,
config
.
VNCPortMin
,
config
.
VNCPortMax
)
vncIp
,
vncPort
:=
vncFinder
.
VNCAddress
(
config
.
VNCPortMin
,
config
.
VNCPortMax
)
if
vncPort
==
0
{
err
:=
fmt
.
Errorf
(
"Unable to find available VNC port between %d and %d"
,
config
.
VNCPortMin
,
config
.
VNCPortMax
)
vncIp
,
vncPort
,
err
:=
vncFinder
.
VNCAddress
(
config
.
VNCPortMin
,
config
.
VNCPortMax
)
if
err
!=
nil
{
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
...
...
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