From 3b3efab80538168dc775b599b7667f2a8366f452 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 11 Jun 2013 14:15:43 -0700 Subject: [PATCH] builder/amazonebs: Tell the user if the termination failed --- builder/amazonebs/step_run_source_instance.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builder/amazonebs/step_run_source_instance.go b/builder/amazonebs/step_run_source_instance.go index 0b2db97fb..06cec67fa 100644 --- a/builder/amazonebs/step_run_source_instance.go +++ b/builder/amazonebs/step_run_source_instance.go @@ -1,6 +1,7 @@ package amazonebs import ( + "fmt" "github.com/mitchellh/goamz/ec2" "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" @@ -55,7 +56,8 @@ func (s *stepRunSourceInstance) Cleanup(state map[string]interface{}) { ec2conn := state["ec2"].(*ec2.EC2) ui := state["ui"].(packer.Ui) - // TODO(mitchellh): error handling ui.Say("Terminating the source AWS instance...") - ec2conn.TerminateInstances([]string{s.instance.InstanceId}) + if _, err := ec2conn.TerminateInstances([]string{s.instance.InstanceId}); err != nil { + ui.Error(fmt.Sprintf("Error terminating instance, may still be around: %s", err)) + } }