Fix describing transit gateways with backoff in ec2_transit_gateway (#67247)

* Fix ec2_transit_gateway retries. AWSRetry must be used within ClientError handling to have any effect

* changelog
This commit is contained in:
Sloane Hertel 2020-02-08 15:48:11 -05:00 committed by GitHub
parent 3f5aed056b
commit 4719072c49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ec2_transit_gateway - Use AWSRetry before ClientError is handled when describing transit gateways

View file

@ -313,7 +313,6 @@ class AnsibleEc2Tgw(object):
return transit_gateway
@AWSRetry.exponential_backoff()
def get_matching_tgw(self, tgw_id, description=None, skip_deleted=True):
""" search for an existing tgw by either tgw_id or description
:param tgw_id: The AWS id of the transit gateway
@ -326,7 +325,7 @@ class AnsibleEc2Tgw(object):
filters = ansible_dict_to_boto3_filter_list({'transit-gateway-id': tgw_id})
try:
response = self._connection.describe_transit_gateways(Filters=filters)
response = AWSRetry.exponential_backoff()(self._connection.describe_transit_gateways)(Filters=filters)
except (ClientError, BotoCoreError) as e:
self._module.fail_json_aws(e)