Merge "Add search index out of sync exception"
This commit is contained in:
commit
7ece72cd83
|
@ -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,
|
||||
|
|
|
@ -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 "
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue