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
171ecaef
Commit
171ecaef
authored
Aug 13, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: guest-additions_url can use Version var [GH-272]
parent
51ed21e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
3 deletions
+31
-3
CHANGELOG.md
CHANGELOG.md
+2
-0
builder/virtualbox/builder.go
builder/virtualbox/builder.go
+12
-2
builder/virtualbox/step_download_guest_additions.go
builder/virtualbox/step_download_guest_additions.go
+17
-1
No files found.
CHANGELOG.md
View file @
171ecaef
...
...
@@ -10,6 +10,8 @@ IMPROVEMENTS:
*
core: built with Go 1.1.2
*
core: packer help output now loads much faster.
*
builder/virtualbox: guest_additions_url can now use the
`Version`
variable to get the VirtualBox version. [GH-272]
*
builder/virtualbox: Do not check for VirtualBox as part of template
validation; only check at execution.
*
builder/vmware: Do not check for VMware as part of template validation;
...
...
builder/virtualbox/builder.go
View file @
171ecaef
...
...
@@ -132,8 +132,6 @@ func (b *Builder) Prepare(raws ...interface{}) error {
// Errors
templates
:=
map
[
string
]
*
string
{
"guest_additions_path"
:
&
b
.
config
.
GuestAdditionsPath
,
"guest_additions_url"
:
&
b
.
config
.
GuestAdditionsURL
,
"guest_additions_sha256"
:
&
b
.
config
.
GuestAdditionsSHA256
,
"guest_os_type"
:
&
b
.
config
.
GuestOSType
,
"http_directory"
:
&
b
.
config
.
HTTPDir
,
...
...
@@ -160,6 +158,18 @@ func (b *Builder) Prepare(raws ...interface{}) error {
}
}
validates
:=
map
[
string
]
*
string
{
"guest_additions_path"
:
&
b
.
config
.
GuestAdditionsPath
,
"guest_additions_url"
:
&
b
.
config
.
GuestAdditionsURL
,
}
for
n
,
ptr
:=
range
validates
{
if
err
:=
b
.
config
.
tpl
.
Validate
(
*
ptr
);
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error parsing %s: %s"
,
n
,
err
))
}
}
for
i
,
command
:=
range
b
.
config
.
BootCommand
{
if
err
:=
b
.
config
.
tpl
.
Validate
(
command
);
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
...
...
builder/virtualbox/step_download_guest_additions.go
View file @
171ecaef
...
...
@@ -21,6 +21,10 @@ var additionsVersionMap = map[string]string{
"4.1.23"
:
"4.1.22"
,
}
type
guestAdditionsUrlTemplate
struct
{
Version
string
}
// This step uploads a file containing the VirtualBox version, which
// can be useful for various provisioning reasons.
//
...
...
@@ -69,7 +73,19 @@ func (s *stepDownloadGuestAdditions) Run(state map[string]interface{}) multistep
// Use the provided source (URL or file path) or generate it
url
:=
config
.
GuestAdditionsURL
if
url
==
""
{
if
url
!=
""
{
tplData
:=
&
guestAdditionsUrlTemplate
{
Version
:
version
,
}
url
,
err
=
config
.
tpl
.
Process
(
url
,
tplData
)
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error preparing guest additions url: %s"
,
err
)
state
[
"error"
]
=
err
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
}
}
else
{
url
=
fmt
.
Sprintf
(
"http://download.virtualbox.org/virtualbox/%s/%s"
,
version
,
...
...
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