From 5631873727186ca1c062f83b46c0414cada7599e Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 31 Oct 2014 16:07:04 +0300 Subject: [PATCH 1/2] allow none checksumtype for qemu builder (copy/paste from virtualbox) Signed-off-by: Vasiliy Tolstov --- builder/qemu/builder.go | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/builder/qemu/builder.go b/builder/qemu/builder.go index 1c3d2cdca..6d98c73d9 100644 --- a/builder/qemu/builder.go +++ b/builder/qemu/builder.go @@ -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")) } - 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 == "" { errs = packer.MultiErrorAppend( errs, errors.New("The iso_checksum_type must be specified.")) } else { b.config.ISOChecksumType = strings.ToLower(b.config.ISOChecksumType) - if h := common.HashForType(b.config.ISOChecksumType); h == nil { - errs = packer.MultiErrorAppend( - errs, - fmt.Errorf("Unsupported checksum type: %s", b.config.ISOChecksumType)) + if b.config.ISOChecksumType != "none" { + 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 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) { 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 { - 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) { From 4762075dc3607234e92ff16973f29676e6a8e4f8 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 31 Oct 2014 16:15:15 +0300 Subject: [PATCH 2/2] add missing variable Signed-off-by: Vasiliy Tolstov --- builder/qemu/builder.go | 1 + 1 file changed, 1 insertion(+) diff --git a/builder/qemu/builder.go b/builder/qemu/builder.go index 6d98c73d9..170b232d7 100644 --- a/builder/qemu/builder.go +++ b/builder/qemu/builder.go @@ -122,6 +122,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { if err != nil { return nil, err } + warnings := make([]string, 0) b.config.tpl, err = packer.NewConfigTemplate() if err != nil {