in ebs, don't clean up temporary amis from encryption step. that's handled in step_copy_ami now

This commit is contained in:
Megan Marsh 2019-05-02 14:38:56 -07:00
parent 8c1d0f9686
commit ae3cf48f71
1 changed files with 2 additions and 4 deletions

View File

@ -95,12 +95,10 @@ func (s *stepCreateAMI) Cleanup(state multistep.StateBag) {
if s.image == nil {
return
}
config := state.Get("config").(*Config)
_, cancelled := state.GetOk(multistep.StateCancelled)
_, halted := state.GetOk(multistep.StateHalted)
encryptBootSet := config.AMIEncryptBootVolume != nil
if !cancelled && !halted && !encryptBootSet {
if !cancelled && !halted {
return
}
@ -108,7 +106,7 @@ func (s *stepCreateAMI) Cleanup(state multistep.StateBag) {
ui := state.Get("ui").(packer.Ui)
ui.Say("Deregistering the AMI and deleting associated snapshots because " +
"of cancellation, error or it was temporary (encrypt_boot was set)...")
"of cancellation, or error...")
resp, err := ec2conn.DescribeImages(&ec2.DescribeImagesInput{
ImageIds: []*string{s.image.ImageId},