providers/digitalocean: handle locked droplets and retry

This commit is contained in:
Jack Pearkes 2014-07-21 11:05:24 -04:00
parent 9c164c6015
commit ed8980714c
2 changed files with 9 additions and 1 deletions

View File

@ -325,6 +325,14 @@ func new_droplet_state_refresh_func(id string, attribute string, client *digital
return nil, "", err
}
// If the droplet is locked, continue waiting. We can
// only perform actions on unlocked droplets, so it's
// pointless to look at that status
if droplet.IsLocked() == "true" {
log.Println("[DEBUG] Droplet is locked, skipping status check and retrying")
return nil, "", nil
}
// Use our mapping to get back a map of the
// droplet properties
resourceMap, err := resource_digitalocean_droplet_update_state(

View File

@ -59,7 +59,7 @@ func TestAccDigitalOceanDroplet_Update(t *testing.T) {
testAccCheckDigitalOceanDropletExists("digitalocean_droplet.foobar", &droplet),
testAccCheckDigitalOceanDropletRenamedAndResized(&droplet),
resource.TestCheckResourceAttr(
"digitalocean_droplet.foobar", "name", "foo"),
"digitalocean_droplet.foobar", "name", "baz"),
resource.TestCheckResourceAttr(
"digitalocean_droplet.foobar", "size", "1gb"),
),