Merge pull request #4422 from bennojoy/nova1
nova compute fix for instance name regex issue
This commit is contained in:
commit
09bb324b2f
1 changed files with 6 additions and 3 deletions
|
@ -128,9 +128,12 @@ EXAMPLES = '''
|
||||||
|
|
||||||
def _delete_server(module, nova):
|
def _delete_server(module, nova):
|
||||||
name = None
|
name = None
|
||||||
|
server_list = None
|
||||||
try:
|
try:
|
||||||
server = nova.servers.list(True, {'name': module.params['name']}).pop()
|
server_list = nova.servers.list(True, {'name': module.params['name']})
|
||||||
nova.servers.delete(server)
|
if server_list:
|
||||||
|
server = [x for x in server_list if x.name == module.params['name']]
|
||||||
|
nova.servers.delete(server.pop())
|
||||||
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)
|
||||||
if module.params['wait'] == 'no':
|
if module.params['wait'] == 'no':
|
||||||
|
@ -187,7 +190,7 @@ def _get_server_state(module, nova):
|
||||||
try:
|
try:
|
||||||
servers = nova.servers.list(True, {'name': module.params['name']})
|
servers = nova.servers.list(True, {'name': module.params['name']})
|
||||||
if servers:
|
if servers:
|
||||||
server = servers.pop()
|
server = [x for x in servers if x.name == module.params['name']]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg = "Error in getting the server list: %s" % e.message)
|
module.fail_json(msg = "Error in getting the server list: %s" % e.message)
|
||||||
if server and module.params['state'] == 'present':
|
if server and module.params['state'] == 'present':
|
||||||
|
|
Loading…
Reference in a new issue