1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

bug fix nova_compute

This commit is contained in:
bennojoy 2013-05-31 17:39:00 +05:30
parent 7628ccbfe4
commit 0b93c68d57

View file

@ -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: