Merge "NSXV: Handle requests ConnectionError exception" into stable/train
This commit is contained in:
commit
07686e11ed
@ -170,6 +170,9 @@ class VcnsApiHelper(object):
|
||||
except requests.exceptions.Timeout:
|
||||
raise exceptions.ResourceTimedOut(uri=uri)
|
||||
|
||||
except requests.exceptions.ConnectionError:
|
||||
raise exceptions.ResourceConnectionError(uri=uri)
|
||||
|
||||
status = response.status_code
|
||||
|
||||
if 200 <= status < 300:
|
||||
|
@ -80,3 +80,7 @@ class ServiceConflict(VcnsApiException):
|
||||
|
||||
class AlreadyExists(VcnsApiException):
|
||||
message = _("Resource %(resource)s already exists")
|
||||
|
||||
|
||||
class ResourceConnectionError(VcnsApiException):
|
||||
message = _("Resource %(uri)s connection error")
|
||||
|
@ -125,6 +125,7 @@ class Vcns(object):
|
||||
self._normalized_global_objects = None
|
||||
|
||||
@retry_upon_exception(exceptions.ServiceConflict)
|
||||
@retry_upon_exception(exceptions.ResourceConnectionError)
|
||||
def _client_request(self, client, method, uri,
|
||||
params, headers, encodeParams, timeout=None):
|
||||
return client(method, uri, params, headers, encodeParams,
|
||||
|
Loading…
Reference in New Issue
Block a user