Merge "Add client search for sql"

This commit is contained in:
Zuul 2018-11-29 07:15:18 +00:00 committed by Gerrit Code Review
commit 5aaf629218
1 changed files with 7 additions and 1 deletions

View File

@ -372,7 +372,6 @@ def filter_tuple_by_search_opt(tuples, search=None):
def get_client(user_id, project_id=None, client_id=None, offset=0,
limit=100, search=None):
search = search or {}
clients = []
session = get_db_session()
with session.begin():
@ -401,6 +400,13 @@ def get_client(user_id, project_id=None, client_id=None, offset=0,
u'description': client.description}
clients.append(clientmap)
# If search opt is wrong, filter will not work,
# return all tuples.
try:
clients = filter_tuple_by_search_opt(clients, search)
except Exception as e:
LOG.error(e)
return clients