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
4b46181f
Commit
4b46181f
authored
Jun 09, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware: require an MD5 for ISO
parent
896c7270
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
builder/vmware/builder.go
builder/vmware/builder.go
+5
-0
builder/vmware/builder_test.go
builder/vmware/builder_test.go
+20
-0
No files found.
builder/vmware/builder.go
View file @
4b46181f
...
@@ -26,6 +26,7 @@ type Builder struct {
...
@@ -26,6 +26,7 @@ type Builder struct {
type
config
struct
{
type
config
struct
{
DiskName
string
`mapstructure:"vmdk_name"`
DiskName
string
`mapstructure:"vmdk_name"`
GuestOSType
string
`mapstructure:"guest_os_type"`
GuestOSType
string
`mapstructure:"guest_os_type"`
ISOMD5
string
`mapstructure:"iso_md5"`
ISOUrl
string
`mapstructure:"iso_url"`
ISOUrl
string
`mapstructure:"iso_url"`
VMName
string
`mapstructure:"vm_name"`
VMName
string
`mapstructure:"vm_name"`
OutputDir
string
`mapstructure:"output_directory"`
OutputDir
string
`mapstructure:"output_directory"`
...
@@ -93,6 +94,10 @@ func (b *Builder) Prepare(raw interface{}) (err error) {
...
@@ -93,6 +94,10 @@ func (b *Builder) Prepare(raw interface{}) (err error) {
errs
=
append
(
errs
,
errors
.
New
(
"http_port_min must be less than http_port_max"
))
errs
=
append
(
errs
,
errors
.
New
(
"http_port_min must be less than http_port_max"
))
}
}
if
b
.
config
.
ISOMD5
==
""
{
errs
=
append
(
errs
,
errors
.
New
(
"Due to large file sizes, an iso_md5 is required"
))
}
if
b
.
config
.
ISOUrl
==
""
{
if
b
.
config
.
ISOUrl
==
""
{
errs
=
append
(
errs
,
errors
.
New
(
"An iso_url must be specified."
))
errs
=
append
(
errs
,
errors
.
New
(
"An iso_url must be specified."
))
}
else
{
}
else
{
...
...
builder/vmware/builder_test.go
View file @
4b46181f
...
@@ -10,6 +10,7 @@ import (
...
@@ -10,6 +10,7 @@ import (
func
testConfig
()
map
[
string
]
interface
{}
{
func
testConfig
()
map
[
string
]
interface
{}
{
return
map
[
string
]
interface
{}{
return
map
[
string
]
interface
{}{
"iso_md5"
:
"foo"
,
"iso_url"
:
"http://www.packer.io"
,
"iso_url"
:
"http://www.packer.io"
,
"ssh_username"
:
"foo"
,
"ssh_username"
:
"foo"
,
}
}
...
@@ -95,6 +96,25 @@ func TestBuilderPrepare_HTTPPort(t *testing.T) {
...
@@ -95,6 +96,25 @@ func TestBuilderPrepare_HTTPPort(t *testing.T) {
}
}
}
}
func
TestBuilderPrepare_ISOMD5
(
t
*
testing
.
T
)
{
var
b
Builder
config
:=
testConfig
()
// Test bad
config
[
"iso_md5"
]
=
""
err
:=
b
.
Prepare
(
config
)
if
err
==
nil
{
t
.
Fatal
(
"should have error"
)
}
// Test good
config
[
"iso_md5"
]
=
"foo"
err
=
b
.
Prepare
(
config
)
if
err
!=
nil
{
t
.
Fatalf
(
"should not have error: %s"
,
err
)
}
}
func
TestBuilderPrepare_ISOUrl
(
t
*
testing
.
T
)
{
func
TestBuilderPrepare_ISOUrl
(
t
*
testing
.
T
)
{
var
b
Builder
var
b
Builder
config
:=
testConfig
()
config
:=
testConfig
()
...
...
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