Commit a7a51f1d authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/amazonebs: Wait for instance to terminate during cleanup

parent 2a490887
......@@ -65,5 +65,9 @@ func (s *stepRunSourceInstance) Cleanup(state map[string]interface{}) {
ui.Say("Terminating the source AWS instance...")
if _, err := ec2conn.TerminateInstances([]string{s.instance.InstanceId}); err != nil {
ui.Error(fmt.Sprintf("Error terminating instance, may still be around: %s", err))
return
}
pending := []string{"pending", "running", "shutting-down", "stopped", "stopping"}
waitForState(ec2conn, s.instance, pending, "terminated")
}
......@@ -67,6 +67,7 @@ func (s *stepSecurityGroup) Cleanup(state map[string]interface{}) {
ui.Say("Deleting temporary security group...")
_, err := ec2conn.DeleteSecurityGroup(ec2.SecurityGroup{Id: s.groupId})
if err != nil {
log.Printf("Error deleting security group: %s", err)
ui.Error(fmt.Sprintf(
"Error cleaning up security group. Please delete the group manually: %s", s.groupId))
}
......
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