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
07cacb6d
Commit
07cacb6d
authored
Jun 11, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: Add GuestOSType config
parent
4c18b0ae
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
builder/virtualbox/builder.go
builder/virtualbox/builder.go
+5
-0
builder/virtualbox/builder_test.go
builder/virtualbox/builder_test.go
+17
-0
No files found.
builder/virtualbox/builder.go
View file @
07cacb6d
...
@@ -18,6 +18,7 @@ type Builder struct {
...
@@ -18,6 +18,7 @@ type Builder struct {
}
}
type
config
struct
{
type
config
struct
{
GuestOSType
string
`mapstructure:"guest_os_type"`
OutputDir
string
`mapstructure:"output_directory"`
OutputDir
string
`mapstructure:"output_directory"`
}
}
...
@@ -27,6 +28,10 @@ func (b *Builder) Prepare(raw interface{}) error {
...
@@ -27,6 +28,10 @@ func (b *Builder) Prepare(raw interface{}) error {
return
err
return
err
}
}
if
b
.
config
.
GuestOSType
==
""
{
b
.
config
.
GuestOSType
=
"Other"
}
if
b
.
config
.
OutputDir
==
""
{
if
b
.
config
.
OutputDir
==
""
{
b
.
config
.
OutputDir
=
"virtualbox"
b
.
config
.
OutputDir
=
"virtualbox"
}
}
...
...
builder/virtualbox/builder_test.go
View file @
07cacb6d
...
@@ -16,3 +16,20 @@ func TestBuilder_ImplementsBuilder(t *testing.T) {
...
@@ -16,3 +16,20 @@ func TestBuilder_ImplementsBuilder(t *testing.T) {
t
.
Error
(
"Builder must implement builder."
)
t
.
Error
(
"Builder must implement builder."
)
}
}
}
}
func
TestBuilderPrepare_Defaults
(
t
*
testing
.
T
)
{
var
b
Builder
config
:=
testConfig
()
err
:=
b
.
Prepare
(
config
)
if
err
!=
nil
{
t
.
Fatalf
(
"should not have error: %s"
,
err
)
}
if
b
.
config
.
GuestOSType
!=
"Other"
{
t
.
Errorf
(
"bad guest OS type: %s"
,
b
.
config
.
GuestOSType
)
}
if
b
.
config
.
OutputDir
!=
"virtualbox"
{
t
.
Errorf
(
"bad output dir: %s"
,
b
.
config
.
OutputDir
)
}
}
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