Backport pagination fix for cloudfront_facts (#42746)

* Fix #38038 cloudfront_facts module returns only first page of response (#38045)

(cherry picked from commit 12057de1c6)

* changelog
pull/42737/merge
Sloane Hertel 6 years ago committed by Matt Clay
parent f5053506d9
commit c40b85d01f

@ -0,0 +1,3 @@
---
bugfixes:
- Allow more than one page of results by using the right pagination indicator ('NextMarker' instead of 'NextToken').

@ -509,8 +509,12 @@ class CloudFrontServiceManager:
else: else:
result = response.get(result_key) result = response.get(result_key)
results.update(result) results.update(result)
args['NextToken'] = response.get('NextToken') args['Marker'] = response.get('NextMarker')
loop = args['NextToken'] is not None for key in response.keys():
if key.endswith('List'):
args['Marker'] = response[key].get('NextMarker')
break
loop = args['Marker'] is not None
return results return results
def keyed_list_helper(self, list_to_key): def keyed_list_helper(self, list_to_key):

Loading…
Cancel
Save