AWSRetry: allow retrying on additional ClientError exceptions (#28483)

* Added the ability to extend the exception list in CloudRetry

* AWSRetry boto and boto compatible

* Updated tests to reflect boto/boto3

* Added boto to shippable requirements

* Have base_class and added_exceptions default to None in CloudRetry

AWSRetry - only retry on boto3 exceptions and remove boto requirement from tests

* Make requested changes.
This commit is contained in:
Sloane Hertel 2017-08-22 15:31:20 -04:00 committed by Ryan Brown
commit 7551e8c921
3 changed files with 29 additions and 14 deletions

View file

@ -72,7 +72,7 @@ class AWSRetry(CloudRetry):
return error.response['Error']['Code']
@staticmethod
def found(response_code):
def found(response_code, catch_extra_error_codes):
# This list of failures is based on this API Reference
# http://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html
#
@ -88,12 +88,11 @@ class AWSRetry(CloudRetry):
'InternalFailure', 'InternalError', 'TooManyRequestsException',
'Throttling'
]
if catch_extra_error_codes:
retry_on.extend(catch_extra_error_codes)
not_found = re.compile(r'^\w+.NotFound')
if response_code in retry_on or not_found.search(response_code):
return True
else:
return False
return response_code in retry_on or not_found.search(response_code)
def boto3_conn(module, conn_type=None, resource=None, region=None, endpoint=None, **params):