From 1d374bc0c2b38e3fc334bc5d248be520d9566d57 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Thu, 25 Feb 2021 01:21:24 +0100 Subject: [PATCH] move describe_addresses call back to non-paginated (pagination not supported) (#441) This commit was initially merged in https://github.com/ansible-collections/community.aws See: https://github.com/ansible-collections/community.aws/commit/2fe5c31f4d5d761d13f1ba146855901231c2525a --- plugins/modules/ec2_vpc_nat_gateway.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plugins/modules/ec2_vpc_nat_gateway.py b/plugins/modules/ec2_vpc_nat_gateway.py index 0fdd6c96b6d..428f82b392b 100644 --- a/plugins/modules/ec2_vpc_nat_gateway.py +++ b/plugins/modules/ec2_vpc_nat_gateway.py @@ -278,12 +278,6 @@ DRY_RUN_MSGS = 'DryRun Mode:' -@AWSRetry.jittered_backoff(retries=10) -def _describe_addresses(client, **params): - paginator = client.get_paginator('describe_addresses') - return paginator.paginate(**params).build_full_result()['Addresses'] - - @AWSRetry.jittered_backoff(retries=10) def _describe_nat_gateways(client, **params): paginator = client.get_paginator('describe_nat_gateways') @@ -546,7 +540,7 @@ def get_eip_allocation_id_by_address(client, eip_address, check_mode=False): err_msg = "" try: if not check_mode: - allocations = _describe_addresses(client, **params) + allocations = client.describe_addresses(aws_retry=True, **params) if len(allocations) == 1: allocation = allocations[0] else: @@ -644,7 +638,7 @@ def release_address(client, allocation_id, check_mode=False): ip_released = False try: - _describe_addresses(client, aws_retry=True, AllocationIds=[allocation_id]) + client.describe_addresses(aws_retry=True, AllocationIds=[allocation_id]) except botocore.exceptions.ClientError as e: # IP address likely already released # Happens with gateway in 'deleted' state that