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
8f8ea60b
Commit
8f8ea60b
authored
Dec 24, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware/common: StepCleanFiles
parent
95e0e465
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
builder/vmware/common/step_clean_files.go
builder/vmware/common/step_clean_files.go
+7
-5
builder/vmware/iso/builder.go
builder/vmware/iso/builder.go
+1
-1
No files found.
builder/vmware/
iso
/step_clean_files.go
→
builder/vmware/
common
/step_clean_files.go
View file @
8f8ea60b
package
iso
package
common
import
(
"fmt"
...
...
@@ -21,9 +21,9 @@ var KeepFileExtensions = []string{".nvram", ".vmdk", ".vmsd", ".vmx", ".vmxf"}
//
// Produces:
// <nothing>
type
s
tepCleanFiles
struct
{}
type
S
tepCleanFiles
struct
{}
func
(
s
tepCleanFiles
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
S
tepCleanFiles
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
dir
:=
state
.
Get
(
"dir"
)
.
(
OutputDir
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
...
...
@@ -49,7 +49,9 @@ func (stepCleanFiles) Run(state multistep.StateBag) multistep.StepAction {
if
!
keep
{
ui
.
Message
(
fmt
.
Sprintf
(
"Deleting: %s"
,
path
))
if
err
=
dir
.
Remove
(
path
);
err
!=
nil
{
// Only report the error if the file still exists
// Only report the error if the file still exists. We do this
// because sometimes the files naturally get removed on their
// own as VMware does its own cleanup.
if
_
,
serr
:=
os
.
Stat
(
path
);
serr
==
nil
||
!
os
.
IsNotExist
(
serr
)
{
state
.
Put
(
"error"
,
err
)
return
multistep
.
ActionHalt
...
...
@@ -61,4 +63,4 @@ func (stepCleanFiles) Run(state multistep.StateBag) multistep.StepAction {
return
multistep
.
ActionContinue
}
func
(
s
tepCleanFiles
)
Cleanup
(
multistep
.
StateBag
)
{}
func
(
S
tepCleanFiles
)
Cleanup
(
multistep
.
StateBag
)
{}
builder/vmware/iso/builder.go
View file @
8f8ea60b
...
...
@@ -411,7 +411,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&
stepUploadTools
{},
&
common
.
StepProvision
{},
&
stepShutdown
{},
&
s
tepCleanFiles
{},
&
vmwcommon
.
S
tepCleanFiles
{},
&
stepCleanVMX
{},
&
stepCompactDisk
{},
}
...
...
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