From bdbc96373674ce8070a7a11df39c835367c8aa3a Mon Sep 17 00:00:00 2001 From: Bryan Larsen Date: Thu, 11 Jul 2013 13:30:42 -0400 Subject: [PATCH] digital_ocean: don't run update_attr if wait=no Sometimes when using digital_ocean with wait=no I get the error "No ip is found". But with wait=no I wouldn't expect there to be any IP, that gets allocated later. However, looking at the code, it turns out that with even with wait=no it waits up to 10 seconds for an IP to be allocated. We could wait longer, but with wait=no that seems like the wrong choice; it's easy enough to grab an IP later with a wait=yes command. To make this change I removed the call to update_attr in @classmethod add. An add is always followed by an ensure_powered_on which will do the update_attr if wait=yes. It would be possible to instead do a call to update_attr with no retries and ignore the errors but I figured it would be better to be consistently not return an IP than to sometimes return it and sometimes not. Inconsistent behaviour makes debugging deployment scripts very difficult. --- library/cloud/digital_ocean | 1 - 1 file changed, 1 deletion(-) diff --git a/library/cloud/digital_ocean b/library/cloud/digital_ocean index 60ee4928fb..dbf8406c77 100644 --- a/library/cloud/digital_ocean +++ b/library/cloud/digital_ocean @@ -233,7 +233,6 @@ class Droplet(JsonfyMixIn): def add(cls, name, size_id, image_id, region_id, ssh_key_ids=None): json = cls.manager.new_droplet(name, size_id, image_id, region_id, ssh_key_ids) droplet = cls(json) - droplet.update_attr() return droplet @classmethod