Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use auto unregister to destroy server

  • Loading branch information...
commit 3e775559e0ea9329d1cad471f3d8bb67e07a95b4 1 parent 3747053
@lirazsiri lirazsiri authored
Showing with 2 additions and 27 deletions.
  1. +2 −27 cloudtask/_hub.py
View
29 cloudtask/_hub.py
@@ -73,32 +73,7 @@ def destroy(self, *addresses):
for server in retry(hub.servers.get, refresh_cache=True)
if server.ipaddress in addresses ]
- addresses = dict([ (server.instanceid, server.ipaddress)
- for server in destroyable ])
-
for server in destroyable:
- retry(server.destroy)
-
- destroyable_ids = set([ server.instanceid for server in destroyable ])
-
- time.sleep(self.wait_first)
-
- addresses_destroyed = []
- while True:
- servers = [ server
- for server in retry(hub.servers.get, refresh_cache=True)
- if server.instanceid in destroyable_ids ]
-
- done = True
- for server in servers:
- if server.status == 'terminated':
- retry(server.unregister)
- addresses_destroyed.append(addresses[server.instanceid])
-
- else:
- done = False
+ retry(server.destroy, auto_unregister=True)
- if done:
- return addresses_destroyed
- else:
- time.sleep(self.wait_status)
+ return [ server.ipaddress for server in destroyable ]
Please sign in to comment.
Something went wrong with that request. Please try again.