bug fix nova_compute

pull/3078/head
bennojoy 12 years ago
parent 7628ccbfe4
commit 0b93c68d57

@ -126,7 +126,7 @@ requirements: ["novaclient"]
def _delete_server(module, nova): def _delete_server(module, nova):
name = None name = None
try: try:
server = nova.servers.list({'name': module.params['name']}).pop() server = nova.servers.list(True, {'name': module.params['name']}).pop()
nova.servers.delete(server) nova.servers.delete(server)
except Exception as e: except Exception as e:
module.fail_json( msg = "Error in deleting vm: %s" % e.message) module.fail_json( msg = "Error in deleting vm: %s" % e.message)
@ -134,7 +134,7 @@ def _delete_server(module, nova):
module.exit_json(changed = True, result = "deleted") module.exit_json(changed = True, result = "deleted")
expire = time.time() + module.params['wait_for'] expire = time.time() + module.params['wait_for']
while time.time() < expire: while time.time() < expire:
name = nova.servers.list({'name': module.params['name']}) name = nova.servers.list(True, {'name': module.params['name']})
if not name: if not name:
module.exit_json(changed = True, result = "deleted") module.exit_json(changed = True, result = "deleted")
time.sleep(5) time.sleep(5)
@ -182,7 +182,7 @@ def _create_server(module, nova):
def _get_server_state(module, nova): def _get_server_state(module, nova):
server = None server = None
try: try:
servers = nova.servers.list({'name': module.params['name']}) servers = nova.servers.list(True, {'name': module.params['name']})
if servers: if servers:
server = servers.pop() server = servers.pop()
except Exception as e: except Exception as e:

Loading…
Cancel
Save