Commit 1df07357 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/digitalocean: retry longer and don't retry shutdown

parent 362c3201
...@@ -6,7 +6,6 @@ import ( ...@@ -6,7 +6,6 @@ import (
"fmt" "fmt"
"github.com/mitchellh/multistep" "github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"time"
) )
type stepCreateDroplet struct { type stepCreateDroplet struct {
...@@ -55,16 +54,7 @@ func (s *stepCreateDroplet) Cleanup(state multistep.StateBag) { ...@@ -55,16 +54,7 @@ func (s *stepCreateDroplet) Cleanup(state multistep.StateBag) {
// Destroy the droplet we just created // Destroy the droplet we just created
ui.Say("Destroying droplet...") ui.Say("Destroying droplet...")
var err error err := client.DestroyDroplet(s.dropletId)
for i := 0; i < 5; i++ {
err = client.DestroyDroplet(s.dropletId)
if err == nil {
break
}
time.Sleep(2 * time.Second)
}
if err != nil { if err != nil {
curlstr := fmt.Sprintf("curl '%v/droplets/%v/destroy?client_id=%v&api_key=%v'", curlstr := fmt.Sprintf("curl '%v/droplets/%v/destroy?client_id=%v&api_key=%v'",
DIGITALOCEAN_API_URL, s.dropletId, c.ClientID, c.APIKey) DIGITALOCEAN_API_URL, s.dropletId, c.ClientID, c.APIKey)
......
...@@ -61,7 +61,7 @@ func (s *stepShutdown) Run(state multistep.StateBag) multistep.StepAction { ...@@ -61,7 +61,7 @@ func (s *stepShutdown) Run(state multistep.StateBag) multistep.StepAction {
} }
}() }()
err = waitForDropletState("off", dropletId, client, 2 * time.Minute) err = waitForDropletState("off", dropletId, client, 2*time.Minute)
if err != nil { if err != nil {
log.Printf("Error waiting for graceful off: %s", err) log.Printf("Error waiting for graceful off: %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