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
pull/67251/head
Sloane Hertel 4 years ago committed by GitHub
parent 3f5aed056b
commit 4719072c49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -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)

Loading…
Cancel
Save