[dynamic-source-ami] rename to source_ami_filter

This commit is contained in:
Chris Lundquist 2016-08-20 23:34:22 +00:00
parent 0e248f1516
commit 95afaa58ca
3 changed files with 6 additions and 6 deletions

View File

@ -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"))
}

View File

@ -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.

View File

@ -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,