Commit 3b3efab8 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/amazonebs: Tell the user if the termination failed

parent ccc95e7e
package amazonebs package amazonebs
import ( import (
"fmt"
"github.com/mitchellh/goamz/ec2" "github.com/mitchellh/goamz/ec2"
"github.com/mitchellh/multistep" "github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
...@@ -55,7 +56,8 @@ func (s *stepRunSourceInstance) Cleanup(state map[string]interface{}) { ...@@ -55,7 +56,8 @@ func (s *stepRunSourceInstance) Cleanup(state map[string]interface{}) {
ec2conn := state["ec2"].(*ec2.EC2) ec2conn := state["ec2"].(*ec2.EC2)
ui := state["ui"].(packer.Ui) ui := state["ui"].(packer.Ui)
// TODO(mitchellh): error handling
ui.Say("Terminating the source AWS instance...") 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))
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment