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
b2287239
Commit
b2287239
authored
Nov 07, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware: for remote builds, put VMX in temp dir
parent
a4b54f1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
builder/vmware/step_create_vmx.go
builder/vmware/step_create_vmx.go
+25
-4
No files found.
builder/vmware/step_create_vmx.go
View file @
b2287239
...
...
@@ -26,9 +26,11 @@ type vmxTemplateData struct {
//
// Produces:
// vmx_path string - The path to the VMX file.
type
stepCreateVMX
struct
{}
type
stepCreateVMX
struct
{
tempDir
string
}
func
(
stepCreateVMX
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
s
tepCreateVMX
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
isoPath
:=
state
.
Get
(
"iso_path"
)
.
(
string
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
...
...
@@ -91,7 +93,23 @@ func (stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction {
// Set this so that no dialogs ever appear from Packer.
vmxData
[
"msg.autoAnswer"
]
=
"true"
vmxPath
:=
filepath
.
Join
(
config
.
OutputDir
,
config
.
VMName
+
".vmx"
)
vmxDir
:=
config
.
OutputDir
if
config
.
RemoteType
!=
""
{
// For remote builds, we just put the VMX in a temporary
// directory since it just gets uploaded anyways.
vmxDir
,
err
=
ioutil
.
TempDir
(
""
,
"packer-vmx"
)
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error preparing VMX template: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
}
// Set the tempDir so we clean it up
s
.
tempDir
=
vmxDir
}
vmxPath
:=
filepath
.
Join
(
vmxDir
,
config
.
VMName
+
".vmx"
)
if
err
:=
WriteVMX
(
vmxPath
,
vmxData
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error creating VMX file: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
...
...
@@ -104,7 +122,10 @@ func (stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction {
return
multistep
.
ActionContinue
}
func
(
stepCreateVMX
)
Cleanup
(
multistep
.
StateBag
)
{
func
(
s
*
stepCreateVMX
)
Cleanup
(
multistep
.
StateBag
)
{
if
s
.
tempDir
!=
""
{
os
.
RemoveAll
(
s
.
tempDir
)
}
}
// This is the default VMX template used if no other template is given.
...
...
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