Handle machines that were already deleted.

Change-Id: I54fb889f8d34cbe1c65ecd35ea90223b3265e892
This commit is contained in:
James E. Blair
2011-11-23 16:26:33 -08:00
parent c14164fb1b
commit 9c063c6a9e

View File

@@ -40,10 +40,13 @@ if CLOUD_SERVERS_DRIVER == 'rackspace':
conn = Driver(CLOUD_SERVERS_USERNAME, CLOUD_SERVERS_API_KEY)
def delete(machine):
node = [n for n in conn.list_nodes() if n.id==str(machine['id'])][0]
node_name = machine['name']
node = [n for n in conn.list_nodes() if n.id==str(machine['id'])]
if not node:
print ' Machine id %s not found' % machine['id']
db.delMachine(machine['id'])
return
node = node[0]
node.destroy()
db.delMachine(machine['id'])
now = time.time()