diff --git a/library/cloud/nova_compute b/library/cloud/nova_compute index af69322933..6e1730ed3b 100644 --- a/library/cloud/nova_compute +++ b/library/cloud/nova_compute @@ -193,7 +193,11 @@ def _get_server_state(module, nova): try: servers = nova.servers.list(True, {'name': module.params['name']}) if servers: - server = [x for x in servers if x.name == module.params['name']][0] + # the {'name': module.params['name']} will also return servers + # with names that partially match the server name, so we have to + # strictly filter here + servers = [x for x in servers if x.name == module.params['name']] + server = servers[0] if servers else None except Exception, e: module.fail_json(msg = "Error in getting the server list: %s" % e.message) if server and module.params['state'] == 'present':