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
850b0664
Commit
850b0664
authored
Apr 21, 2014
by
Ross Smith II
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #945 from benlangfeld:feature/vb_output_opts (manually)
parents
da7dd7f8
128f555a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
75 additions
and
7 deletions
+75
-7
CHANGELOG.md
CHANGELOG.md
+3
-1
builder/virtualbox/common/export_opts.go
builder/virtualbox/common/export_opts.go
+27
-0
builder/virtualbox/common/export_opts_test.go
builder/virtualbox/common/export_opts_test.go
+20
-0
builder/virtualbox/common/step_export.go
builder/virtualbox/common/step_export.go
+7
-2
builder/virtualbox/iso/builder.go
builder/virtualbox/iso/builder.go
+5
-2
builder/virtualbox/ovf/builder.go
builder/virtualbox/ovf/builder.go
+3
-2
builder/virtualbox/ovf/config.go
builder/virtualbox/ovf/config.go
+2
-0
website/source/docs/builders/virtualbox-iso.html.markdown
website/source/docs/builders/virtualbox-iso.html.markdown
+4
-0
website/source/docs/builders/virtualbox-ovf.html.markdown
website/source/docs/builders/virtualbox-ovf.html.markdown
+4
-0
No files found.
CHANGELOG.md
View file @
850b0664
...
...
@@ -13,6 +13,8 @@ IMPROVEMENTS:
*
builder/amazon: Added
`ssh_private_key_file`
option [GH-971]
*
builder/qemu: User variable expansion in
`ssh_key_path`
[GH-918]
*
builder/virtualbox: Support an
`export_opts`
option which allows
specifying arbitrary arguments when exporting the VM. [GH-945]
*
builder/vmware: Workstation 10 support for Linux. [GH-900]
*
builder/vmware: add cloning support on Windows [GH-824]
*
command/build: Added '-parallel' flag so you can disable parallelization
...
...
@@ -30,7 +32,7 @@ BUG FIXES:
*
builder/openstack: Return proper error on invalid instance states [GH-1018]
*
builder/virtualbox-iso: Retry unregister a few times to deal with
VBoxManage randomness. [GH-915]
*
provisioner/ansible: Fix paths when provisioning Linux from
*
provisioner/ansible: Fix paths when provisioning Linux from
Windows [GH-963]
*
provisioner/ansible: set cwd to staging directory [GH-1016]
*
provisioners/chef-client: Don't chown directory with Ubuntu. [GH-939]
...
...
builder/virtualbox/common/export_opts.go
0 → 100644
View file @
850b0664
package
common
import
(
"fmt"
"github.com/mitchellh/packer/packer"
)
type
ExportOpts
struct
{
ExportOpts
[]
string
`mapstructure:"export_opts"`
}
func
(
c
*
ExportOpts
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
if
c
.
ExportOpts
==
nil
{
c
.
ExportOpts
=
make
([]
string
,
0
)
}
errs
:=
make
([]
error
,
0
)
for
i
,
str
:=
range
c
.
ExportOpts
{
var
err
error
c
.
ExportOpts
[
i
],
err
=
t
.
Process
(
str
,
nil
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
"export_opts"
,
err
))
}
}
return
errs
}
builder/virtualbox/common/export_opts_test.go
0 → 100644
View file @
850b0664
package
common
import
(
"testing"
)
func
TestExportOptsPrepare_BootWait
(
t
*
testing
.
T
)
{
var
c
*
ExportOpts
var
errs
[]
error
// Good
c
=
new
(
ExportOpts
)
c
.
ExportOpts
=
[]
string
{
"--options"
,
}
errs
=
c
.
Prepare
(
testConfigTemplate
(
t
))
if
len
(
errs
)
>
0
{
t
.
Fatalf
(
"should not have error: %s"
,
errs
)
}
}
builder/virtualbox/common/step_export.go
View file @
850b0664
...
...
@@ -6,6 +6,7 @@ import (
"github.com/mitchellh/packer/packer"
"log"
"path/filepath"
"strings"
"time"
)
...
...
@@ -16,8 +17,9 @@ import (
// Produces:
// exportPath string - The path to the resulting export.
type
StepExport
struct
{
Format
string
OutputDir
string
Format
string
OutputDir
string
ExportOpts
[]
string
}
func
(
s
*
StepExport
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
...
...
@@ -52,7 +54,10 @@ func (s *StepExport) Run(state multistep.StateBag) multistep.StepAction {
outputPath
,
}
command
=
append
(
command
,
s
.
ExportOpts
...
)
ui
.
Say
(
"Exporting virtual machine..."
)
ui
.
Message
(
fmt
.
Sprintf
(
"Executing: %s"
,
strings
.
Join
(
command
,
" "
)))
err
:=
driver
.
VBoxManage
(
command
...
)
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error exporting virtual machine: %s"
,
err
)
...
...
builder/virtualbox/iso/builder.go
View file @
850b0664
...
...
@@ -29,6 +29,7 @@ type Builder struct {
type
config
struct
{
common
.
PackerConfig
`mapstructure:",squash"`
vboxcommon
.
ExportConfig
`mapstructure:",squash"`
vboxcommon
.
ExportOpts
`mapstructure:",squash"`
vboxcommon
.
FloppyConfig
`mapstructure:",squash"`
vboxcommon
.
OutputConfig
`mapstructure:",squash"`
vboxcommon
.
RunConfig
`mapstructure:",squash"`
...
...
@@ -73,6 +74,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
// Accumulate any errors and warnings
errs
:=
common
.
CheckUnusedConfig
(
md
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
ExportConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
ExportOpts
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
FloppyConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
OutputConfig
.
Prepare
(
b
.
config
.
tpl
,
&
b
.
config
.
PackerConfig
)
...
)
...
...
@@ -317,8 +319,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
},
new
(
vboxcommon
.
StepRemoveDevices
),
&
vboxcommon
.
StepExport
{
Format
:
b
.
config
.
Format
,
OutputDir
:
b
.
config
.
OutputDir
,
Format
:
b
.
config
.
Format
,
OutputDir
:
b
.
config
.
OutputDir
,
ExportOpts
:
b
.
config
.
ExportOpts
.
ExportOpts
,
},
}
...
...
builder/virtualbox/ovf/builder.go
View file @
850b0664
...
...
@@ -95,8 +95,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
},
new
(
vboxcommon
.
StepRemoveDevices
),
&
vboxcommon
.
StepExport
{
Format
:
b
.
config
.
Format
,
OutputDir
:
b
.
config
.
OutputDir
,
Format
:
b
.
config
.
Format
,
OutputDir
:
b
.
config
.
OutputDir
,
ExportOpts
:
b
.
config
.
ExportOpts
.
ExportOpts
,
},
}
...
...
builder/virtualbox/ovf/config.go
View file @
850b0664
...
...
@@ -13,6 +13,7 @@ import (
type
Config
struct
{
common
.
PackerConfig
`mapstructure:",squash"`
vboxcommon
.
ExportConfig
`mapstructure:",squash"`
vboxcommon
.
ExportOpts
`mapstructure:",squash"`
vboxcommon
.
FloppyConfig
`mapstructure:",squash"`
vboxcommon
.
OutputConfig
`mapstructure:",squash"`
vboxcommon
.
RunConfig
`mapstructure:",squash"`
...
...
@@ -49,6 +50,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
// Prepare the errors
errs
:=
common
.
CheckUnusedConfig
(
md
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
ExportConfig
.
Prepare
(
c
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
ExportOpts
.
Prepare
(
c
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
FloppyConfig
.
Prepare
(
c
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
OutputConfig
.
Prepare
(
c
.
tpl
,
&
c
.
PackerConfig
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
c
.
RunConfig
.
Prepare
(
c
.
tpl
)
...
)
...
...
website/source/docs/builders/virtualbox-iso.html.markdown
View file @
850b0664
...
...
@@ -211,6 +211,10 @@ Optional:
machine, without the file extension. By default this is "packer-BUILDNAME",
where "BUILDNAME" is the name of the build.
*
`export_opts`
(array of strings) - Additional options to pass to the
`VBoxManage export`
.
This can be useful for passing product information to include in the resulting
appliance file.
## Boot Command
The
`boot_command`
configuration is very important: it specifies the keys
...
...
website/source/docs/builders/virtualbox-ovf.html.markdown
View file @
850b0664
...
...
@@ -151,6 +151,10 @@ Optional:
This can be useful for passing "keepallmacs" or "keepnatmacs" options for existing
ovf images.
*
`export_opts`
(array of strings) - Additional options to pass to the
`VBoxManage export`
.
This can be useful for passing product information to include in the resulting
appliance file.
## Guest Additions
Packer will automatically download the proper guest additions for the
...
...
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