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
6516e5a6
Commit
6516e5a6
authored
Jun 12, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: export
parent
48a3892c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
builder/virtualbox/builder.go
builder/virtualbox/builder.go
+1
-0
builder/virtualbox/step_export.go
builder/virtualbox/step_export.go
+46
-0
No files found.
builder/virtualbox/builder.go
View file @
6516e5a6
...
@@ -196,6 +196,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -196,6 +196,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
new
(
stepWaitForSSH
),
new
(
stepWaitForSSH
),
new
(
stepProvision
),
new
(
stepProvision
),
new
(
stepShutdown
),
new
(
stepShutdown
),
new
(
stepExport
),
}
}
// Setup the state bag
// Setup the state bag
...
...
builder/virtualbox/step_export.go
0 → 100644
View file @
6516e5a6
package
virtualbox
import
(
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"path/filepath"
)
// This step creates the virtual disk that will be used as the
// hard drive for the virtual machine.
//
// Uses:
//
// Produces:
// exportPath string - The path to the resulting export.
type
stepExport
struct
{}
func
(
s
*
stepExport
)
Run
(
state
map
[
string
]
interface
{})
multistep
.
StepAction
{
config
:=
state
[
"config"
]
.
(
*
config
)
driver
:=
state
[
"driver"
]
.
(
Driver
)
ui
:=
state
[
"ui"
]
.
(
packer
.
Ui
)
vmName
:=
state
[
"vmName"
]
.
(
string
)
outputPath
:=
filepath
.
Join
(
config
.
OutputDir
,
"packer.ovf"
)
command
:=
[]
string
{
"export"
,
vmName
,
"--output"
,
outputPath
,
}
ui
.
Say
(
"Exporting virtual machine..."
)
err
:=
driver
.
VBoxManage
(
command
...
)
if
err
!=
nil
{
ui
.
Error
(
fmt
.
Sprintf
(
"Error exporting virtual machine: %s"
,
err
))
return
multistep
.
ActionHalt
}
state
[
"exportPath"
]
=
outputPath
return
multistep
.
ActionContinue
}
func
(
s
*
stepExport
)
Cleanup
(
state
map
[
string
]
interface
{})
{}
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