mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
[cloud] Retry WAF actions on WAFStaleDataException (#36405)
Add a util to run functions with AWSRetry to retry on WAFStaleDataExceptions and update ChangeToken for each attempt
This commit is contained in:
parent
9598978e12
commit
f7d79d4789
5 changed files with 65 additions and 39 deletions
|
@ -180,3 +180,9 @@ def get_change_token(client, module):
|
|||
return token['ChangeToken']
|
||||
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
|
||||
module.fail_json_aws(e, msg="Couldn't obtain change token")
|
||||
|
||||
|
||||
@AWSRetry.backoff(tries=10, delay=2, backoff=2.0, catch_extra_error_codes=['WAFStaleDataException'])
|
||||
def run_func_with_change_token_backoff(client, module, params, func):
|
||||
params['ChangeToken'] = get_change_token(client, module)
|
||||
return func(**params)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue