From ce8d3d3747c57d5a5dbe6a6073f1ad3840ae3f5f Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 16 Mar 2020 12:35:25 +0100 Subject: [PATCH] wip --- builder/amazon/chroot/builder.go | 7 +------ builder/amazon/common/ami_config.go | 11 ++--------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go index 23b3bec04..93f9f2981 100644 --- a/builder/amazon/chroot/builder.go +++ b/builder/amazon/chroot/builder.go @@ -260,12 +260,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { var warns []string errs = packer.MultiErrorAppend(errs, b.config.RootVolumeTag.CopyOn(b.config.RootVolumeTags)...) - - for _, preparer := range []interface{ Prepare() []error }{ - &b.config.SourceAmiFilter, - } { - errs = packer.MultiErrorAppend(errs, preparer.Prepare()...) - } + errs = packer.MultiErrorAppend(errs, b.config.SourceAmiFilter.Prepare()...) errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, diff --git a/builder/amazon/common/ami_config.go b/builder/amazon/common/ami_config.go index 0174e7882..18911e405 100644 --- a/builder/amazon/common/ami_config.go +++ b/builder/amazon/common/ami_config.go @@ -151,15 +151,8 @@ func stringInSlice(s []string, searchstr string) bool { func (c *AMIConfig) Prepare(accessConfig *AccessConfig, ctx *interpolate.Context) []error { var errs []error - for _, s := range []struct { - tagMap TagMap - kvs hcl2template.KeyValues - }{ - {c.SnapshotTags, c.SnapshotTag}, - {c.AMITags, c.AMITag}, - } { - errs = append(errs, s.kvs.CopyOn(s.tagMap)...) - } + errs = append(errs, c.SnapshotTag.CopyOn(c.SnapshotTags)...) + errs = append(errs, c.AMITag.CopyOn(c.AMITags)...) if c.AMIName == "" { errs = append(errs, fmt.Errorf("ami_name must be specified"))