builder/amazon/common: retry deleting security group [GH-278]
This commit is contained in:
parent
34556713dc
commit
c09c1108ca
|
@ -29,6 +29,8 @@ IMPROVEMENTS:
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
|
* builder/amazon/ebs,instance: Retry deleing security group a few times.
|
||||||
|
[GH-278]
|
||||||
* builder/vmware: Workstation works on Windows XP now. [GH-238]
|
* builder/vmware: Workstation works on Windows XP now. [GH-238]
|
||||||
* builder/vmware: Look for files on Windows in multiple locations
|
* builder/vmware: Look for files on Windows in multiple locations
|
||||||
using multiple environmental variables. [GH-263]
|
using multiple environmental variables. [GH-263]
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
"github.com/mitchellh/packer/packer"
|
"github.com/mitchellh/packer/packer"
|
||||||
"log"
|
"log"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepSecurityGroup struct {
|
type StepSecurityGroup struct {
|
||||||
|
@ -83,9 +84,18 @@ func (s *StepSecurityGroup) Cleanup(state map[string]interface{}) {
|
||||||
ui := state["ui"].(packer.Ui)
|
ui := state["ui"].(packer.Ui)
|
||||||
|
|
||||||
ui.Say("Deleting temporary security group...")
|
ui.Say("Deleting temporary security group...")
|
||||||
_, err := ec2conn.DeleteSecurityGroup(ec2.SecurityGroup{Id: s.createdGroupId})
|
|
||||||
|
var err error
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
_, err = ec2conn.DeleteSecurityGroup(ec2.SecurityGroup{Id: s.createdGroupId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error deleting security group: %s", err)
|
log.Printf("Error deleting security group: %s", err)
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
ui.Error(fmt.Sprintf(
|
ui.Error(fmt.Sprintf(
|
||||||
"Error cleaning up security group. Please delete the group manually: %s", s.createdGroupId))
|
"Error cleaning up security group. Please delete the group manually: %s", s.createdGroupId))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue