Merge pull request #1645 from vtolstov/qemu_disk
Allow none checksumtype for qemu builder
This commit is contained in:
commit
96c813684e
|
@ -122,6 +122,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
warnings := make([]string, 0)
|
||||||
|
|
||||||
b.config.tpl, err = packer.NewConfigTemplate()
|
b.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -304,22 +305,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 +407,17 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
||||||
b.config.QemuArgs = make([][]string, 0)
|
b.config.QemuArgs = make([][]string, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errs != nil && len(errs.Errors) > 0 {
|
if b.config.ISOChecksumType == "none" {
|
||||||
return nil, errs
|
warnings = append(warnings,
|
||||||
|
"A checksum type of 'none' was specified. Since ISO files are so big,\n"+
|
||||||
|
"a checksum is highly recommended.")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, nil
|
if errs != nil && len(errs.Errors) > 0 {
|
||||||
|
return warnings, errs
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
|
Loading…
Reference in New Issue