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
909d5ccb
Commit
909d5ccb
authored
Aug 22, 2014
by
Mikhail Zholobov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/parallels: 'ToolsIsoPath' added
parent
668bd51f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
4 deletions
+35
-4
builder/parallels/common/driver.go
builder/parallels/common/driver.go
+3
-0
builder/parallels/common/driver_9.go
builder/parallels/common/driver_9.go
+21
-4
builder/parallels/common/driver_mock.go
builder/parallels/common/driver_mock.go
+11
-0
No files found.
builder/parallels/common/driver.go
View file @
909d5ccb
...
...
@@ -27,6 +27,9 @@ type Driver interface {
// Prlctl executes the given Prlctl command
Prlctl
(
...
string
)
error
// Get the path to the Parallels Tools ISO for the given flavor.
ToolsIsoPath
(
string
)
(
string
,
error
)
// Verify checks to make sure that this driver should function
// properly. If there is any indication the driver can't function,
// this will return an error.
...
...
builder/parallels/common/driver_9.go
View file @
909d5ccb
...
...
@@ -6,6 +6,7 @@ import (
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"time"
...
...
@@ -73,16 +74,21 @@ func getConfigValueFromXpath(path, xpath string) (string, error) {
// Finds an application bundle by identifier (for "darwin" platform only)
func
getAppPath
(
bundleId
string
)
(
string
,
error
)
{
var
stdout
bytes
.
Buffer
cmd
:=
exec
.
Command
(
"mdfind"
,
"kMDItemCFBundleIdentifier =="
,
bundleId
)
out
,
err
:=
cmd
.
Output
()
if
err
!=
nil
{
cmd
.
Stdout
=
&
stdout
if
err
:=
cmd
.
Run
();
err
!=
nil
{
return
""
,
err
}
if
string
(
out
)
==
""
{
pathOutput
:=
strings
.
TrimSpace
(
stdout
.
String
())
if
pathOutput
==
""
{
return
""
,
fmt
.
Errorf
(
"Could not detect Parallels Desktop! Make sure it is properly installed."
)
}
return
string
(
out
),
nil
return
pathOutput
,
nil
}
func
(
d
*
Parallels9Driver
)
IsRunning
(
name
string
)
(
bool
,
error
)
{
...
...
@@ -251,3 +257,14 @@ func (d *Parallels9Driver) IpAddress(mac string) (string, error) {
log
.
Printf
(
"Found IP lease: %s for MAC address %s
\n
"
,
ip
,
mac
)
return
ip
,
nil
}
func
(
d
*
Parallels9Driver
)
ToolsIsoPath
(
k
string
)
(
string
,
error
)
{
appPath
,
err
:=
getAppPath
(
"com.parallels.desktop.console"
)
if
err
!=
nil
{
return
""
,
err
}
toolsPath
:=
filepath
.
Join
(
appPath
,
"Contents"
,
"Resources"
,
"Tools"
,
"prl-tools-"
+
k
+
".iso"
)
log
.
Printf
(
"Parallels Tools path: '%s'"
,
toolsPath
)
return
toolsPath
,
nil
}
builder/parallels/common/driver_mock.go
View file @
909d5ccb
...
...
@@ -31,6 +31,11 @@ type DriverMock struct {
SendKeyScanCodesCalls
[][]
string
SendKeyScanCodesErrs
[]
error
ToolsIsoPathCalled
bool
ToolsIsoPathFlavor
string
ToolsIsoPathResult
string
ToolsIsoPathErr
error
MacName
string
MacReturn
string
MacError
error
...
...
@@ -98,3 +103,9 @@ func (d *DriverMock) IpAddress(mac string) (string, error) {
d
.
IpAddressMac
=
mac
return
d
.
IpAddressReturn
,
d
.
IpAddressError
}
func
(
d
*
DriverMock
)
ToolsIsoPath
(
flavor
string
)
(
string
,
error
)
{
d
.
ToolsIsoPathCalled
=
true
d
.
ToolsIsoPathFlavor
=
flavor
return
d
.
ToolsIsoPathResult
,
d
.
ToolsIsoPathErr
}
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