Skip to content

Commit

Permalink
elb_application_lb_info - ensure queries for additional ALB data are …
Browse files Browse the repository at this point in the history
…have retries enabled
  • Loading branch information
tremble committed Sep 26, 2023
1 parent 9f7c4af commit e77e356
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bug_fixes:
- elb_application_lb_info - ensure all API queries use the retry decorator (https://github.com/ansible-collections/amazon.aws/issues/1767).
10 changes: 5 additions & 5 deletions plugins/modules/elb_application_lb_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,22 +232,22 @@ def get_paginator(connection, **kwargs):

def get_alb_listeners(connection, module, alb_arn):
try:
return connection.describe_listeners(LoadBalancerArn=alb_arn)["Listeners"]
return connection.describe_listeners(aws_retry=True, LoadBalancerArn=alb_arn)["Listeners"]
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
module.fail_json_aws(e, msg="Failed to describe alb listeners")


def get_listener_rules(connection, module, listener_arn):
try:
return connection.describe_rules(ListenerArn=listener_arn)["Rules"]
return connection.describe_rules(aws_retry=True, ListenerArn=listener_arn)["Rules"]
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
module.fail_json_aws(e, msg="Failed to describe listener rules")


def get_load_balancer_attributes(connection, module, load_balancer_arn):
try:
load_balancer_attributes = boto3_tag_list_to_ansible_dict(
connection.describe_load_balancer_attributes(LoadBalancerArn=load_balancer_arn)["Attributes"]
connection.describe_load_balancer_attributes(aws_retry=True, LoadBalancerArn=load_balancer_arn)["Attributes"]
)
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
module.fail_json_aws(e, msg="Failed to describe load balancer attributes")
Expand All @@ -263,15 +263,15 @@ def get_load_balancer_attributes(connection, module, load_balancer_arn):
def get_load_balancer_tags(connection, module, load_balancer_arn):
try:
return boto3_tag_list_to_ansible_dict(
connection.describe_tags(ResourceArns=[load_balancer_arn])["TagDescriptions"][0]["Tags"]
connection.describe_tags(aws_retry=True, ResourceArns=[load_balancer_arn])["TagDescriptions"][0]["Tags"]
)
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
module.fail_json_aws(e, msg="Failed to describe load balancer tags")


def get_load_balancer_ipaddresstype(connection, module, load_balancer_arn):
try:
return connection.describe_load_balancers(LoadBalancerArns=[load_balancer_arn])["LoadBalancers"][0][
return connection.describe_load_balancers(aws_retry=True, LoadBalancerArns=[load_balancer_arn])["LoadBalancers"][0][
"IpAddressType"
]
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
Expand Down

0 comments on commit e77e356

Please sign in to comment.