Merge "Add search index out of sync exception"

This commit is contained in:
Zuul 2019-12-03 06:43:24 +00:00 committed by Gerrit Code Review
commit 7ece72cd83
3 changed files with 8 additions and 3 deletions

View File

@ -37,6 +37,7 @@ def http_error_to_exception(status_code, error_code):
requests.codes.BAD_REQUEST:
{'60508': exceptions.NsxIndexingInProgress,
'60514': exceptions.NsxSearchTimeout,
'60515': exceptions.NsxSearchOutOfSync,
'8327': exceptions.NsxOverlapVlan,
'500045': exceptions.NsxPendingDelete,
'500030': exceptions.ResourceInUse,

View File

@ -197,6 +197,10 @@ class NsxSearchTimeout(NsxSearchError):
"or running low on resources")
class NsxSearchOutOfSync(NsxSearchError):
message = _("Index is currently out of sync")
class NsxPendingDelete(NsxLibException):
message = _("An object with the same name is marked for deletion. Either "
"use another path or wait for the purge cycle to permanently "

View File

@ -152,7 +152,7 @@ class NsxLibBase(object):
url = self._add_pagination_parameters("search?query=%s" % query,
cursor, page_size)
# Retry the search on case of error
# Retry the search in case of error
@utils.retry_upon_exception(exceptions.NsxSearchError,
max_attempts=self.client.max_attempts)
def do_search(url):
@ -189,8 +189,8 @@ class NsxLibBase(object):
url = self._add_pagination_parameters("search?query=%s" % query,
cursor, page_size)
# Retry the search on case of error
@utils.retry_upon_exception(exceptions.NsxIndexingInProgress,
# Retry the search in case of error
@utils.retry_upon_exception(exceptions.NsxSearchError,
max_attempts=self.client.max_attempts)
def do_search(url):
return self.client.url_get(url)