From dc0de7da4901588b2cb4c607a1f0d572901bf564 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 8 Sep 2014 09:52:49 -0700 Subject: [PATCH] builder/amazon-ebs: don't clean up AMI if doesn't exist [GH-1469] --- builder/amazon/ebs/step_create_ami.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/builder/amazon/ebs/step_create_ami.go b/builder/amazon/ebs/step_create_ami.go index 7dda9e32b..967ad2d39 100644 --- a/builder/amazon/ebs/step_create_ami.go +++ b/builder/amazon/ebs/step_create_ami.go @@ -69,9 +69,12 @@ func (s *stepCreateAMI) Run(state multistep.StateBag) multistep.StepAction { } func (s *stepCreateAMI) Cleanup(state multistep.StateBag) { + if s.image == nil { + return + } + _, cancelled := state.GetOk(multistep.StateCancelled) _, halted := state.GetOk(multistep.StateHalted) - if !cancelled && !halted { return }