Skip to content

Commit

Permalink
Add retry decorator to ansibleawsmodule.client example module to cope…
Browse files Browse the repository at this point in the history
… with rate limiting errors (#196)
  • Loading branch information
tremble authored Nov 16, 2020
1 parent 69e25d3 commit f400f62
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
pass # Handled by AnsibleAWSModule

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ansible_dict_to_boto3_filter_list
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict

Expand All @@ -25,7 +26,8 @@ def main():
supports_check_mode=True,
)

client = module.client('ec2')
decorator = AWSRetry.jittered_backoff()
client = module.client('ec2', retry_decorator=decorator)

filters = ansible_dict_to_boto3_filter_list({'name': 'amzn2-ami-hvm-2.0.202006*-x86_64-gp2'})

Expand Down

0 comments on commit f400f62

Please sign in to comment.