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
b2b74431
Commit
b2b74431
authored
May 27, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/parallels/pvm: interpolation
parent
76c2d2cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
41 deletions
+25
-41
builder/parallels/pvm/builder.go
builder/parallels/pvm/builder.go
+3
-3
builder/parallels/pvm/config.go
builder/parallels/pvm/config.go
+22
-38
No files found.
builder/parallels/pvm/builder.go
View file @
b2b74431
...
...
@@ -68,7 +68,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
new
(
parallelscommon
.
StepAttachFloppy
),
&
parallelscommon
.
StepPrlctl
{
Commands
:
b
.
config
.
Prlctl
,
Tpl
:
b
.
config
.
tpl
,
Ctx
:
b
.
config
.
ctx
,
},
&
parallelscommon
.
StepRun
{
BootWait
:
b
.
config
.
BootWait
,
...
...
@@ -78,7 +78,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
BootCommand
:
b
.
config
.
BootCommand
,
HostInterfaces
:
[]
string
{},
VMName
:
b
.
config
.
VMName
,
Tpl
:
b
.
config
.
tpl
,
Ctx
:
b
.
config
.
ctx
,
},
&
common
.
StepConnectSSH
{
SSHAddress
:
parallelscommon
.
SSHAddress
,
...
...
@@ -92,7 +92,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
ParallelsToolsFlavor
:
b
.
config
.
ParallelsToolsFlavor
,
ParallelsToolsGuestPath
:
b
.
config
.
ParallelsToolsGuestPath
,
ParallelsToolsMode
:
b
.
config
.
ParallelsToolsMode
,
Tpl
:
b
.
config
.
tpl
,
Ctx
:
b
.
config
.
ctx
,
},
new
(
common
.
StepProvision
),
&
parallelscommon
.
StepShutdown
{
...
...
builder/parallels/pvm/config.go
View file @
b2b74431
...
...
@@ -6,7 +6,9 @@ import (
parallelscommon
"github.com/mitchellh/packer/builder/parallels/common"
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/helper/config"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/template/interpolate"
)
// Config is the configuration structure for the builder.
...
...
@@ -26,57 +28,39 @@ type Config struct {
VMName
string
`mapstructure:"vm_name"`
ReassignMac
bool
`mapstructure:"reassign_mac"`
tpl
*
packer
.
ConfigTemplate
ctx
interpolate
.
Context
}
func
NewConfig
(
raws
...
interface
{})
(
*
Config
,
[]
string
,
error
)
{
c
:=
new
(
Config
)
md
,
err
:=
common
.
DecodeConfig
(
c
,
raws
...
)
err
:=
config
.
Decode
(
&
c
,
&
config
.
DecodeOpts
{
Interpolate
:
true
,
InterpolateFilter
:
&
interpolate
.
RenderFilter
{
Exclude
:
[]
string
{
"boot_command"
,
"prlctl"
,
"parallel_tools_guest_path"
,
},
},
},
raws
...
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
c
.
tpl
,
err
=
packer
.
NewConfigTemplate
()
if
err
!=
nil
{
return
nil
,
nil
,
err
}
c
.
tpl
.
UserVars
=
c
.
PackerUserVars
if
c
.
VMName
==
""
{
c
.
VMName
=
fmt
.
Sprintf
(
"packer-%s-{{timestamp}}"
,
c
.
PackerBuildName
)
}
// Prepare the errors
errs
:=
common
.
CheckUnusedConfig
(
md
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
FloppyConfig
.
Prepare
(
c
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
OutputConfig
.
Prepare
(
c
.
tpl
,
&
c
.
PackerConfig
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
PrlctlConfig
.
Prepare
(
c
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
PrlctlVersionConfig
.
Prepare
(
c
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
RunConfig
.
Prepare
(
c
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
ShutdownConfig
.
Prepare
(
c
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
SSHConfig
.
Prepare
(
c
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
ToolsConfig
.
Prepare
(
c
.
tpl
)
...
)
templates
:=
map
[
string
]
*
string
{
"source_path"
:
&
c
.
SourcePath
,
"vm_name"
:
&
c
.
VMName
,
}
for
n
,
ptr
:=
range
templates
{
var
err
error
*
ptr
,
err
=
c
.
tpl
.
Process
(
*
ptr
,
nil
)
if
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
n
,
err
))
}
}
for
i
,
command
:=
range
c
.
BootCommand
{
if
err
:=
c
.
tpl
.
Validate
(
command
);
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing boot_command[%d]: %s"
,
i
,
err
))
}
}
var
errs
*
packer
.
MultiError
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
.
PrlctlVersionConfig
.
Prepare
(
&
c
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
RunConfig
.
Prepare
(
&
c
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
ShutdownConfig
.
Prepare
(
&
c
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
SSHConfig
.
Prepare
(
&
c
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
ToolsConfig
.
Prepare
(
&
c
.
ctx
)
...
)
if
c
.
SourcePath
==
""
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"source_path is required"
))
...
...
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