Skip to content

Commit

Permalink
stability: Increase the number of retries on ec2_instance tests (ansi…
Browse files Browse the repository at this point in the history
…ble-collections#187)

* Split imports into a single line

* Increase the max_attempts retries for the ec2_instance tests, we're running a *lot* in parallel which triggers RateLimiting errors
  • Loading branch information
tremble authored and jillr committed May 10, 2021
1 parent 54ac242 commit 2461440
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
18 changes: 9 additions & 9 deletions plugins/modules/ec2_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,17 +810,17 @@

from ansible.module_utils.six import string_types
from ansible.module_utils.six.moves.urllib import parse as urlparse
from ansible.module_utils._text import to_bytes
from ansible.module_utils._text import to_native
import ansible_collections.amazon.aws.plugins.module_utils.ec2 as ec2_utils
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import (AWSRetry,
ansible_dict_to_boto3_filter_list,
compare_aws_tags,
boto3_tag_list_to_ansible_dict,
ansible_dict_to_boto3_tag_list,
camel_dict_to_snake_dict,
)

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 compare_aws_tags
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import boto3_tag_list_to_ansible_dict
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ansible_dict_to_boto3_tag_list
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import snake_dict_to_camel_dict

module = None

Expand Down Expand Up @@ -917,7 +917,7 @@ def build_volume_spec(params):
for int_value in ['volume_size', 'iops']:
if int_value in volume['ebs']:
volume['ebs'][int_value] = int(volume['ebs'][int_value])
return [ec2_utils.snake_dict_to_camel_dict(v, capitalize_first=True) for v in volumes]
return [snake_dict_to_camel_dict(v, capitalize_first=True) for v in volumes]


def add_or_update_instance_profile(instance, desired_profile_name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
aws_secret_key: "{{ aws_secret_key }}"
security_token: "{{ security_token | default(omit) }}"
region: "{{ aws_region }}"
aws_config:
retries:
# Unfortunately AWSRetry doesn't support paginators and boto3's paginators
# don't support any configuration of the delay between retries.
max_attempts: 20
collections:
- amazon.aws
block:
Expand Down

0 comments on commit 2461440

Please sign in to comment.