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
0c5ea9aa
Commit
0c5ea9aa
authored
Jun 22, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'rickard-von-essen-issue_2080'
parents
5db4d7c0
13c2c466
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
85 additions
and
0 deletions
+85
-0
builder/parallels/common/prlctl_post_config.go
builder/parallels/common/prlctl_post_config.go
+28
-0
builder/parallels/common/prlctl_post_config_test.go
builder/parallels/common/prlctl_post_config_test.go
+37
-0
builder/parallels/iso/builder.go
builder/parallels/iso/builder.go
+6
-0
builder/parallels/pvm/builder.go
builder/parallels/pvm/builder.go
+4
-0
builder/parallels/pvm/config.go
builder/parallels/pvm/config.go
+2
-0
website/source/docs/builders/parallels-iso.html.markdown
website/source/docs/builders/parallels-iso.html.markdown
+4
-0
website/source/docs/builders/parallels-pvm.html.markdown
website/source/docs/builders/parallels-pvm.html.markdown
+4
-0
No files found.
builder/parallels/common/prlctl_post_config.go
0 → 100644
View file @
0c5ea9aa
package
common
import
(
"fmt"
"github.com/mitchellh/packer/packer"
)
type
PrlctlPostConfig
struct
{
PrlctlPost
[][]
string
`mapstructure:"prlctl_post"`
}
func
(
c
*
PrlctlPostConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
if
c
.
PrlctlPost
==
nil
{
c
.
PrlctlPost
=
make
([][]
string
,
0
)
}
errs
:=
make
([]
error
,
0
)
for
i
,
args
:=
range
c
.
PrlctlPost
{
for
j
,
arg
:=
range
args
{
if
err
:=
t
.
Validate
(
arg
);
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing prlctl_post[%d][%d]: %s"
,
i
,
j
,
err
))
}
}
}
return
errs
}
builder/parallels/common/prlctl_post_config_test.go
0 → 100644
View file @
0c5ea9aa
package
common
import
(
"reflect"
"testing"
)
func
TestPrlctlPostConfigPrepare_PrlctlPost
(
t
*
testing
.
T
)
{
// Test with empty
c
:=
new
(
PrlctlPostConfig
)
errs
:=
c
.
Prepare
(
testConfigTemplate
(
t
))
if
len
(
errs
)
>
0
{
t
.
Fatalf
(
"err: %#v"
,
errs
)
}
if
!
reflect
.
DeepEqual
(
c
.
PrlctlPost
,
[][]
string
{})
{
t
.
Fatalf
(
"bad: %#v"
,
c
.
PrlctlPost
)
}
// Test with a good one
c
=
new
(
PrlctlPostConfig
)
c
.
PrlctlPost
=
[][]
string
{
{
"foo"
,
"bar"
,
"baz"
},
}
errs
=
c
.
Prepare
(
testConfigTemplate
(
t
))
if
len
(
errs
)
>
0
{
t
.
Fatalf
(
"err: %#v"
,
errs
)
}
expected
:=
[][]
string
{
[]
string
{
"foo"
,
"bar"
,
"baz"
},
}
if
!
reflect
.
DeepEqual
(
c
.
PrlctlPost
,
expected
)
{
t
.
Fatalf
(
"bad: %#v"
,
c
.
PrlctlPost
)
}
}
builder/parallels/iso/builder.go
View file @
0c5ea9aa
...
...
@@ -27,6 +27,7 @@ type Config struct {
parallelscommon
.
FloppyConfig
`mapstructure:",squash"`
parallelscommon
.
OutputConfig
`mapstructure:",squash"`
parallelscommon
.
PrlctlConfig
`mapstructure:",squash"`
parallelscommon
.
PrlctlPostConfig
`mapstructure:",squash"`
parallelscommon
.
PrlctlVersionConfig
`mapstructure:",squash"`
parallelscommon
.
RunConfig
`mapstructure:",squash"`
parallelscommon
.
ShutdownConfig
`mapstructure:",squash"`
...
...
@@ -78,6 +79,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
errs
,
b
.
config
.
OutputConfig
.
Prepare
(
&
b
.
config
.
ctx
,
&
b
.
config
.
PackerConfig
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
RunConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
PrlctlConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
PrlctlPostConfig
.
Prepare
(
&
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
PrlctlVersionConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
ShutdownConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
SSHConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
...
...
@@ -266,6 +268,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
Command
:
b
.
config
.
ShutdownCommand
,
Timeout
:
b
.
config
.
ShutdownTimeout
,
},
&
parallelscommon
.
StepPrlctl
{
Commands
:
b
.
config
.
PrlctlPost
,
Tpl
:
b
.
config
.
tpl
,
},
}
// Setup the state bag
...
...
builder/parallels/pvm/builder.go
View file @
0c5ea9aa
...
...
@@ -101,6 +101,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
Command
:
b
.
config
.
ShutdownCommand
,
Timeout
:
b
.
config
.
ShutdownTimeout
,
},
&
parallelscommon
.
StepPrlctl
{
Commands
:
b
.
config
.
PrlctlPost
,
Tpl
:
b
.
config
.
tpl
,
},
}
// Run the steps.
...
...
builder/parallels/pvm/config.go
View file @
0c5ea9aa
...
...
@@ -17,6 +17,7 @@ type Config struct {
parallelscommon
.
FloppyConfig
`mapstructure:",squash"`
parallelscommon
.
OutputConfig
`mapstructure:",squash"`
parallelscommon
.
PrlctlConfig
`mapstructure:",squash"`
parallelscommon
.
PrlctlPostConfig
`mapstructure:",squash"`
parallelscommon
.
PrlctlVersionConfig
`mapstructure:",squash"`
parallelscommon
.
RunConfig
`mapstructure:",squash"`
parallelscommon
.
SSHConfig
`mapstructure:",squash"`
...
...
@@ -57,6 +58,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
FloppyConfig
.
Prepare
(
&
c
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
OutputConfig
.
Prepare
(
&
c
.
ctx
,
&
c
.
PackerConfig
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
PrlctlConfig
.
Prepare
(
&
c
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
PrlctlPostConfig
.
Prepare
(
&
c
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
PrlctlVersionConfig
.
Prepare
(
&
c
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
RunConfig
.
Prepare
(
&
c
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
ShutdownConfig
.
Prepare
(
&
c
.
ctx
)
...
)
...
...
website/source/docs/builders/parallels-iso.html.markdown
View file @
0c5ea9aa
...
...
@@ -172,6 +172,10 @@ each category, the available options are alphabetized and described.
where the
`Name`
variable is replaced with the VM name. More details on how
to use
`prlctl`
are below.
*
`prlctl_post`
(array of array of strings) - Identical to
`prlctl`
,
except that it is run after the virtual machine is shutdown, and before the
virtual machine is exported.
*
`prlctl_version_file`
(string) - The path within the virtual machine to upload
a file that contains the
`prlctl`
version that was used to create the machine.
This information can be useful for provisioning. By default this is
...
...
website/source/docs/builders/parallels-pvm.html.markdown
View file @
0c5ea9aa
...
...
@@ -115,6 +115,10 @@ each category, the available options are alphabetized and described.
where the
`Name`
variable is replaced with the VM name. More details on how
to use
`prlctl`
are below.
*
`prlctl_post`
(array of array of strings) - Identical to
`prlctl`
,
except that it is run after the virtual machine is shutdown, and before the
virtual machine is exported.
*
`prlctl_version_file`
(string) - The path within the virtual machine to upload
a file that contains the
`prlctl`
version that was used to create the machine.
This information can be useful for provisioning. By default this is
...
...
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