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
9b203912
Commit
9b203912
authored
Sep 05, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox-ovf: import_flags [GH-1383]
parent
863e06a6
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
20 deletions
+48
-20
CHANGELOG.md
CHANGELOG.md
+3
-0
builder/virtualbox/common/driver.go
builder/virtualbox/common/driver.go
+1
-1
builder/virtualbox/common/driver_4_2.go
builder/virtualbox/common/driver_4_2.go
+2
-2
builder/virtualbox/common/driver_mock.go
builder/virtualbox/common/driver_mock.go
+3
-3
builder/virtualbox/ovf/builder.go
builder/virtualbox/ovf/builder.go
+3
-3
builder/virtualbox/ovf/config.go
builder/virtualbox/ovf/config.go
+28
-7
builder/virtualbox/ovf/step_import.go
builder/virtualbox/ovf/step_import.go
+4
-4
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 @
9b203912
...
...
@@ -15,6 +15,9 @@ FEATURES:
Packer will look in the PWD and the directory with
`packer`
for
binaries named
`packer-TYPE-NAME`
.
*
builder/docker: Images can now be committed instead of exported. [GH-1198]
*
builder/virtualbox-ovf: New
`import_flags`
setting can be used to add
new command line flags to
`VBoxManage import`
to allow things such
as EULAs to be accepted. [GH-1383]
*
builder/vmware: VMware Player 6 is now supported. [GH-1168]
IMPROVEMENTS:
...
...
builder/virtualbox/common/driver.go
View file @
9b203912
...
...
@@ -23,7 +23,7 @@ type Driver interface {
Delete
(
string
)
error
// Import a VM
Import
(
string
,
string
,
string
)
error
Import
(
string
,
string
,
[]
string
)
error
// The complete path to the Guest Additions ISO
Iso
()
(
string
,
error
)
...
...
builder/virtualbox/common/driver_4_2.go
View file @
9b203912
...
...
@@ -69,13 +69,13 @@ func (d *VBox42Driver) Iso() (string, error) {
return
""
,
fmt
.
Errorf
(
"Cannot find
\"
Default Guest Additions ISO
\"
in vboxmanage output"
)
}
func
(
d
*
VBox42Driver
)
Import
(
name
,
path
,
opts
string
)
error
{
func
(
d
*
VBox42Driver
)
Import
(
name
string
,
path
string
,
flags
[]
string
)
error
{
args
:=
[]
string
{
"import"
,
path
,
"--vsys"
,
"0"
,
"--vmname"
,
name
,
"--options"
,
opts
,
}
args
=
append
(
args
,
flags
...
)
return
d
.
VBoxManage
(
args
...
)
}
...
...
builder/virtualbox/common/driver_mock.go
View file @
9b203912
...
...
@@ -16,7 +16,7 @@ type DriverMock struct {
ImportCalled
bool
ImportName
string
ImportPath
string
Import
Opts
string
Import
Flags
[]
string
ImportErr
error
IsoCalled
bool
...
...
@@ -55,11 +55,11 @@ func (d *DriverMock) Delete(name string) error {
return
d
.
DeleteErr
}
func
(
d
*
DriverMock
)
Import
(
name
,
path
,
opts
string
)
error
{
func
(
d
*
DriverMock
)
Import
(
name
string
,
path
string
,
flags
[]
string
)
error
{
d
.
ImportCalled
=
true
d
.
ImportName
=
name
d
.
ImportPath
=
path
d
.
Import
Opts
=
opt
s
d
.
Import
Flags
=
flag
s
return
d
.
ImportErr
}
...
...
builder/virtualbox/ovf/builder.go
View file @
9b203912
...
...
@@ -70,7 +70,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&
StepImport
{
Name
:
b
.
config
.
VMName
,
SourcePath
:
b
.
config
.
SourcePath
,
Import
Opts
:
b
.
config
.
ImportOpt
s
,
Import
Flags
:
b
.
config
.
ImportFlag
s
,
},
&
vboxcommon
.
StepAttachGuestAdditions
{
GuestAdditionsMode
:
b
.
config
.
GuestAdditionsMode
,
...
...
builder/virtualbox/ovf/config.go
View file @
9b203912
...
...
@@ -31,6 +31,7 @@ type Config struct {
GuestAdditionsSHA256
string
`mapstructure:"guest_additions_sha256"`
VMName
string
`mapstructure:"vm_name"`
ImportOpts
string
`mapstructure:"import_opts"`
ImportFlags
[]
string
`mapstructure:"import_flags"`
tpl
*
packer
.
ConfigTemplate
}
...
...
@@ -90,6 +91,21 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
}
}
sliceTemplates
:=
map
[
string
][]
string
{
"import_flags"
:
c
.
ImportFlags
,
}
for
n
,
slice
:=
range
sliceTemplates
{
for
i
,
elem
:=
range
slice
{
var
err
error
slice
[
i
],
err
=
c
.
tpl
.
Process
(
elem
,
nil
)
if
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing %s[%d]: %s"
,
n
,
i
,
err
))
}
}
}
if
c
.
SourcePath
==
""
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"source_path is required"
))
}
else
{
...
...
@@ -147,5 +163,10 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
return
nil
,
warnings
,
errs
}
// TODO: Write a packer fix and just remove import_opts
if
c
.
ImportOpts
!=
""
{
c
.
ImportFlags
=
append
(
c
.
ImportFlags
,
"--options"
,
c
.
ImportOpts
)
}
return
c
,
warnings
,
nil
}
builder/virtualbox/ovf/step_import.go
View file @
9b203912
...
...
@@ -11,7 +11,7 @@ import (
type
StepImport
struct
{
Name
string
SourcePath
string
Import
Opts
string
Import
Flags
[]
string
vmName
string
}
...
...
@@ -21,7 +21,7 @@ func (s *StepImport) Run(state multistep.StateBag) multistep.StepAction {
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
.
Say
(
fmt
.
Sprintf
(
"Importing VM: %s"
,
s
.
SourcePath
))
if
err
:=
driver
.
Import
(
s
.
Name
,
s
.
SourcePath
,
s
.
Import
Opt
s
);
err
!=
nil
{
if
err
:=
driver
.
Import
(
s
.
Name
,
s
.
SourcePath
,
s
.
Import
Flag
s
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error importing VM: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
...
...
website/source/docs/builders/virtualbox-ovf.html.markdown
View file @
9b203912
...
...
@@ -96,6 +96,10 @@ each category, the available options are alphabetized and described.
machine being built. When this value is set to true, the machine will
start without a console.
*
`import_flags`
(array of strings) - Additional flags to pass to
`VBoxManage import`
. This can be used to add additional command-line flags
such as
`--eula-accept`
to accept a EULA in the OVF.
*
`import_opts`
(string) - Additional options to pass to the
`VBoxManage import`
.
This can be useful for passing "keepallmacs" or "keepnatmacs" options for existing
ovf images.
...
...
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