Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #1384/569fff4c backport][stable-4] route53_info - fix max_items when not paginating #1388

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/1384-route53_info-fix-max-items.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- route53_info - fix ``max_items`` parameter when used with non-paginated commands (https://github.com/ansible-collections/community.aws/issues/1383).
10 changes: 2 additions & 8 deletions plugins/modules/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
16 changes: 16 additions & 0 deletions tests/integration/targets/route53/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@
- hosted_zones.HostedZone.ResourceRecordSetCount == 2
- hosted_zones.HostedZone.Config.PrivateZone

# Needs CI permissions updated
# # Ensure that we can use the non-paginated list_by_name method with max_items
# - name: Get zone 1 details only
# route53_info:
# query: hosted_zone
# hosted_zone_method: list_by_name
# dns_name: '{{ zone_one }}'
# max_items: 1
# register: list_by_name_result
#
# - name: Assert that we found exactly one zone when querying by name
# assert:
# that:
# - list_by_name_result.HostedZones | length == 1
# - list_by_name_result.HostedZones[0].Name == '{{ zone_one }}'

- name: 'Create A record using zone fqdn'
route53:
state: present
Expand Down