builder/digitalocean: retry destroy a few times
This commit is contained in:
parent
977969a7e9
commit
d8b048662f
|
@ -20,6 +20,8 @@ BUG FIXES:
|
|||
* core: Concurrent map access is completely gone, fixing rare issues
|
||||
with runtime memory corruption. [GH-307]
|
||||
* core: Fix possible panic when ctrl-C during provisioner run.
|
||||
* builder/digitalocean: Retry destroy a few times because DO sometimes
|
||||
gives false errors.
|
||||
* provisioners/salt-masterless: Use filepath join to properly join paths.
|
||||
|
||||
## 0.3.5 (August 28, 2013)
|
||||
|
|
|
@ -62,12 +62,20 @@ func (s *stepCreateDroplet) Cleanup(state multistep.StateBag) {
|
|||
log.Printf("Sleeping for %v, event_delay", c.RawEventDelay)
|
||||
time.Sleep(c.eventDelay)
|
||||
|
||||
err := client.DestroyDroplet(s.dropletId)
|
||||
var err error
|
||||
for i := 0; i < 5; i++ {
|
||||
err = client.DestroyDroplet(s.dropletId)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
|
||||
curlstr := fmt.Sprintf("curl '%v/droplets/%v/destroy?client_id=%v&api_key=%v'",
|
||||
DIGITALOCEAN_API_URL, s.dropletId, c.ClientID, c.APIKey)
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
curlstr := fmt.Sprintf("curl '%v/droplets/%v/destroy?client_id=%v&api_key=%v'",
|
||||
DIGITALOCEAN_API_URL, s.dropletId, c.ClientID, c.APIKey)
|
||||
|
||||
ui.Error(fmt.Sprintf(
|
||||
"Error destroying droplet. Please destroy it manually: %v", curlstr))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue