From 95afaa58ca370eaa6d266117c0a0f1cf80b2c722 Mon Sep 17 00:00:00 2001 From: Chris Lundquist Date: Sat, 20 Aug 2016 23:34:22 +0000 Subject: [PATCH] [dynamic-source-ami] rename to source_ami_filter --- builder/amazon/common/run_config.go | 8 ++++---- builder/amazon/common/step_source_ami_info.go | 2 +- builder/amazon/ebs/builder.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go index b3fc15a94..4de010a71 100644 --- a/builder/amazon/common/run_config.go +++ b/builder/amazon/common/run_config.go @@ -14,13 +14,13 @@ import ( var reShutdownBehavior = regexp.MustCompile("^(stop|terminate)$") -type DynamicAmiOptions struct { +type AmiFilterOptions struct { Filters map[*string]*string Owners []*string MostRecent bool `mapstructure:"most_recent"` } -func (d *DynamicAmiOptions) Empty() bool { +func (d *AmiFilterOptions) Empty() bool { return len(d.Owners) == 0 && len(d.Filters) == 0 } @@ -34,7 +34,7 @@ type RunConfig struct { InstanceType string `mapstructure:"instance_type"` RunTags map[string]string `mapstructure:"run_tags"` SourceAmi string `mapstructure:"source_ami"` - DynamicSourceAmi DynamicAmiOptions `mapstructure:"dynamic_source_ami"` + SourceAmiFilter AmiFilterOptions `mapstructure:"source_ami_filter"` SpotPrice string `mapstructure:"spot_price"` SpotPriceAutoProduct string `mapstructure:"spot_price_auto_product"` DisableStopInstance bool `mapstructure:"disable_stop_instance"` @@ -67,7 +67,7 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { // Validation errs := c.Comm.Prepare(ctx) - if c.SourceAmi == "" && c.DynamicSourceAmi.Empty() { + if c.SourceAmi == "" && c.SourceAmiFilter.Empty() { errs = append(errs, errors.New("A source_ami or dynamic_source_ami must be specified")) } diff --git a/builder/amazon/common/step_source_ami_info.go b/builder/amazon/common/step_source_ami_info.go index 6946650c1..caaf167b8 100644 --- a/builder/amazon/common/step_source_ami_info.go +++ b/builder/amazon/common/step_source_ami_info.go @@ -19,7 +19,7 @@ import ( type StepSourceAMIInfo struct { SourceAmi string EnhancedNetworking bool - AmiFilters DynamicAmiOptions + AmiFilters AmiFilterOptions } // Build a slice of AMI filter options from the filters provided. diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go index 4566679ec..319a8bbd2 100644 --- a/builder/amazon/ebs/builder.go +++ b/builder/amazon/ebs/builder.go @@ -100,7 +100,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &awscommon.StepSourceAMIInfo{ SourceAmi: b.config.SourceAmi, EnhancedNetworking: b.config.AMIEnhancedNetworking, - AmiFilters: b.config.DynamicSourceAmi, + AmiFilters: b.config.SourceAmiFilter, }, &awscommon.StepKeyPair{ Debug: b.config.PackerDebug,