Merge pull request #4649 from mitchellh/forcederegister

builder/amazon: set force_deregister to true on -force
This commit is contained in:
Matthew Hooker 2017-03-09 16:31:52 -08:00 committed by GitHub
commit 9de7e65b73
4 changed files with 16 additions and 0 deletions

View File

@ -78,6 +78,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
return nil, err return nil, err
} }
if b.config.PackerConfig.PackerForce {
b.config.AMIForceDeregister = true
}
// Defaults // Defaults
if b.config.ChrootMounts == nil { if b.config.ChrootMounts == nil {
b.config.ChrootMounts = make([][]string, 0) b.config.ChrootMounts = make([][]string, 0)

View File

@ -58,6 +58,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
return nil, err return nil, err
} }
if b.config.PackerConfig.PackerForce {
b.config.AMIForceDeregister = true
}
// Accumulate any errors // Accumulate any errors
var errs *packer.MultiError var errs *packer.MultiError
errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...)

View File

@ -58,6 +58,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
return nil, err return nil, err
} }
if b.config.PackerConfig.PackerForce {
b.config.AMIForceDeregister = true
}
// Accumulate any errors // Accumulate any errors
var errs *packer.MultiError var errs *packer.MultiError
errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...)

View File

@ -77,6 +77,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
return nil, err return nil, err
} }
if b.config.PackerConfig.PackerForce {
b.config.AMIForceDeregister = true
}
if b.config.BundleDestination == "" { if b.config.BundleDestination == "" {
b.config.BundleDestination = "/tmp" b.config.BundleDestination = "/tmp"
} }