Skip to content

Commit

Permalink
route53_info - fix max_items when not paginating (ansible-collections…
Browse files Browse the repository at this point in the history
…#1384)

route53_info - fix max_items when not paginating

SUMMARY
As reported in ansible-collections#1383, the route53_info module presently fails to run with a boto3 parameter validation error if run with particular combinations of parameters, specifically:

query: hosted_zone parameter with hosted_zone_method: list_by_name
query: reusable_delegation_set without specifying a delegation_set_id

I believe this is a regression introduced in ansible-collections#813
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
route53_info
ADDITIONAL INFORMATION
Some further information is described in the issue but tl;dr the prior PR converted all cases in the module where params['MaxItems'] was set to instead pass a params['PaginationConfig'], however this should only be done if a boto3 paginator is actually being used, and will fail (as noted above, due to parameter validation) if called with a regular boto3 client method.
Hence this PR switches back to directly setting MaxItems on the methods that do not use a paginator.

Reviewed-by: Mark Chappell <None>
  • Loading branch information
mcoot authored and abikouo committed Sep 18, 2023
1 parent f41976c commit c4edf10
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions route53_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,8 @@ def reusable_delegation_set_details():
params = dict()

if not module.params.get('delegation_set_id'):
# Set PaginationConfig with max_items
if module.params.get('max_items'):
params['PaginationConfig'] = dict(
MaxItems=module.params.get('max_items')
)
params['MaxItems'] = str(module.params.get('max_items'))

if module.params.get('next_marker'):
params['Marker'] = module.params.get('next_marker')
Expand Down Expand Up @@ -581,11 +578,8 @@ def list_hosted_zones_by_name():
if module.params.get('dns_name'):
params['DNSName'] = module.params.get('dns_name')

# Set PaginationConfig with max_items
if module.params.get('max_items'):
params['PaginationConfig'] = dict(
MaxItems=module.params.get('max_items')
)
params['MaxItems'] = str(module.params.get('max_items'))

return client.list_hosted_zones_by_name(**params)

Expand Down

0 comments on commit c4edf10

Please sign in to comment.