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
64aed2b3
Commit
64aed2b3
authored
Jun 19, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: proper artifact [GH-23]
parent
b8103ff9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
1 deletion
+54
-1
builder/virtualbox/artifact.go
builder/virtualbox/artifact.go
+33
-0
builder/virtualbox/builder.go
builder/virtualbox/builder.go
+21
-1
No files found.
builder/virtualbox/artifact.go
0 → 100644
View file @
64aed2b3
package
virtualbox
import
(
"fmt"
"os"
)
// Artifact is the result of running the VirtualBox 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
)
}
func
(
a
*
Artifact
)
Destroy
()
error
{
return
os
.
RemoveAll
(
a
.
dir
)
}
builder/virtualbox/builder.go
View file @
64aed2b3
...
...
@@ -11,6 +11,7 @@ import (
"net/url"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
)
...
...
@@ -231,7 +232,26 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
return
nil
,
rawErr
.
(
error
)
}
return
nil
,
nil
// Compile the artifact list
files
:=
make
([]
string
,
0
,
5
)
visit
:=
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
if
!
info
.
IsDir
()
{
files
=
append
(
files
,
path
)
}
return
err
}
if
err
:=
filepath
.
Walk
(
b
.
config
.
OutputDir
,
visit
);
err
!=
nil
{
return
nil
,
err
}
artifact
:=
&
Artifact
{
dir
:
b
.
config
.
OutputDir
,
f
:
files
,
}
return
artifact
,
nil
}
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