From e439dd039be444d9f5fe033425c60a81a31ed7e0 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Mon, 21 Oct 2019 14:08:49 -0700 Subject: [PATCH] fix tests --- builder/hyperv/common/config.go | 10 +++++----- builder/hyperv/iso/builder.go | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/builder/hyperv/common/config.go b/builder/hyperv/common/config.go index 982f9c6ac..e890d5ac3 100644 --- a/builder/hyperv/common/config.go +++ b/builder/hyperv/common/config.go @@ -153,8 +153,8 @@ type CommonConfig struct { func (c *CommonConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) ([]error, []string) { // Accumulate any errors and warns - errs := make([]error, 0) - warns := make([]string, 0) + var errs []error + var warns []string if c.VMName == "" { c.VMName = fmt.Sprintf("packer-%s", pc.PackerBuildName) @@ -178,12 +178,12 @@ func (c *CommonConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig } if len(c.AdditionalDiskSize) > 64 { - err := fmt.Errorf("VM's currently support a maximum of 64 additional SCSI attached disks.") - errs = append(errs, err) + errs = append(errs, fmt.Errorf("VM's currently support a maximum of 64 additional SCSI attached disks.")) } // Errors - errs = c.FloppyConfig.Prepare(ctx) + floppyerrs := c.FloppyConfig.Prepare(ctx) + errs = append(errs, floppyerrs...) if c.GuestAdditionsMode == "" { if c.GuestAdditionsPath != "" { c.GuestAdditionsMode = "attach" diff --git a/builder/hyperv/iso/builder.go b/builder/hyperv/iso/builder.go index 1ee63f142..796182760 100644 --- a/builder/hyperv/iso/builder.go +++ b/builder/hyperv/iso/builder.go @@ -53,7 +53,6 @@ type Config struct { common.PackerConfig `mapstructure:",squash"` common.HTTPConfig `mapstructure:",squash"` common.ISOConfig `mapstructure:",squash"` - common.FloppyConfig `mapstructure:",squash"` bootcommand.BootConfig `mapstructure:",squash"` hypervcommon.OutputConfig `mapstructure:",squash"` hypervcommon.SSHConfig `mapstructure:",squash"` @@ -108,7 +107,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { errs = packer.MultiErrorAppend(errs, isoErrs...) errs = packer.MultiErrorAppend(errs, b.config.BootConfig.Prepare(&b.config.ctx)...) - errs = packer.MultiErrorAppend(errs, b.config.FloppyConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.HTTPConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.OutputConfig.Prepare(&b.config.ctx, &b.config.PackerConfig)...) errs = packer.MultiErrorAppend(errs, b.config.SSHConfig.Prepare(&b.config.ctx)...)