Commit 56318737 authored by Vasiliy Tolstov's avatar Vasiliy Tolstov

allow none checksumtype for qemu builder (copy/paste from virtualbox)

Signed-off-by: default avatarVasiliy Tolstov <v.tolstov@selfip.ru>
parent 399837b0
...@@ -304,22 +304,24 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { ...@@ -304,22 +304,24 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
errs, errors.New("http_port_min must be less than http_port_max")) errs, errors.New("http_port_min must be less than http_port_max"))
} }
if b.config.ISOChecksum == "" {
errs = packer.MultiErrorAppend(
errs, errors.New("Due to large file sizes, an iso_checksum is required"))
} else {
b.config.ISOChecksum = strings.ToLower(b.config.ISOChecksum)
}
if b.config.ISOChecksumType == "" { if b.config.ISOChecksumType == "" {
errs = packer.MultiErrorAppend( errs = packer.MultiErrorAppend(
errs, errors.New("The iso_checksum_type must be specified.")) errs, errors.New("The iso_checksum_type must be specified."))
} else { } else {
b.config.ISOChecksumType = strings.ToLower(b.config.ISOChecksumType) b.config.ISOChecksumType = strings.ToLower(b.config.ISOChecksumType)
if h := common.HashForType(b.config.ISOChecksumType); h == nil { if b.config.ISOChecksumType != "none" {
errs = packer.MultiErrorAppend( if b.config.ISOChecksum == "" {
errs, errs = packer.MultiErrorAppend(
fmt.Errorf("Unsupported checksum type: %s", b.config.ISOChecksumType)) errs, errors.New("Due to large file sizes, an iso_checksum is required"))
} else {
b.config.ISOChecksum = strings.ToLower(b.config.ISOChecksum)
}
if h := common.HashForType(b.config.ISOChecksumType); h == nil {
errs = packer.MultiErrorAppend(
errs,
fmt.Errorf("Unsupported checksum type: %s", b.config.ISOChecksumType))
}
} }
} }
...@@ -404,11 +406,17 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { ...@@ -404,11 +406,17 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
b.config.QemuArgs = make([][]string, 0) b.config.QemuArgs = make([][]string, 0)
} }
if b.config.ISOChecksumType == "none" {
warnings = append(warnings,
"A checksum type of 'none' was specified. Since ISO files are so big,\n"+
"a checksum is highly recommended.")
}
if errs != nil && len(errs.Errors) > 0 { if errs != nil && len(errs.Errors) > 0 {
return nil, errs return warnings, errs
} }
return nil, nil return warnings, nil
} }
func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment