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
f851e56d
Commit
f851e56d
authored
Jun 06, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware: Artifacts implemented
parent
378a7320
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
1 deletion
+64
-1
builder/vmware/artifact.go
builder/vmware/artifact.go
+26
-0
builder/vmware/artifact_test.go
builder/vmware/artifact_test.go
+14
-0
builder/vmware/builder.go
builder/vmware/builder.go
+24
-1
No files found.
builder/vmware/artifact.go
0 → 100644
View file @
f851e56d
package
vmware
import
"fmt"
// Artifact is the result of running the VMware builder, namely a set
// of files associated with the resulting machine.
type
Artifact
struct
{
dir
string
f
[]
string
}
func
(
*
Artifact
)
BuilderId
()
string
{
return
BuilderId
}
func
(
a
*
Artifact
)
Files
()
[]
string
{
return
a
.
f
}
func
(
*
Artifact
)
Id
()
string
{
return
"VM"
}
func
(
a
*
Artifact
)
String
()
string
{
return
fmt
.
Sprintf
(
"VM files in directory: %s"
,
a
.
dir
)
}
builder/vmware/artifact_test.go
0 → 100644
View file @
f851e56d
package
vmware
import
(
"testing"
"github.com/mitchellh/packer/packer"
)
func
TestArtifact_Impl
(
t
*
testing
.
T
)
{
var
raw
interface
{}
raw
=
&
Artifact
{}
if
_
,
ok
:=
raw
.
(
packer
.
Artifact
);
!
ok
{
t
.
Fatal
(
"Artifact must be a proper artifact"
)
}
}
builder/vmware/builder.go
View file @
f851e56d
...
...
@@ -7,6 +7,8 @@ import (
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"log"
"os"
"path/filepath"
"time"
)
...
...
@@ -114,7 +116,28 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) packer.Artifact {
b
.
runner
=
&
multistep
.
BasicRunner
{
Steps
:
steps
}
b
.
runner
.
Run
(
state
)
return
nil
// If we were interrupted or cancelled, then just exit.
if
_
,
ok
:=
state
[
multistep
.
StateCancelled
];
ok
{
return
nil
}
if
_
,
ok
:=
state
[
multistep
.
StateHalted
];
ok
{
return
nil
}
// Compile the artifact list
files
:=
make
([]
string
,
0
,
10
)
visit
:=
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
files
=
append
(
files
,
path
)
return
err
}
if
err
:=
filepath
.
Walk
(
b
.
config
.
OutputDir
,
visit
);
err
!=
nil
{
ui
.
Error
(
fmt
.
Sprintf
(
"Error collecting result files: %s"
,
err
))
return
nil
}
return
&
Artifact
{
b
.
config
.
OutputDir
,
files
}
}
func
(
b
*
Builder
)
Cancel
()
{
...
...
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