1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

made paging marker configurable as boto differs

This commit is contained in:
Brian Coca 2016-04-15 10:36:45 -04:00
parent 0820ac5f7f
commit 7062e086d4

View file

@ -238,8 +238,11 @@ def ec2_connect(module):
return ec2 return ec2
def paging(pause=0): def paging(pause=0, marker_property='marker'):
""" Adds paging to boto retrieval functions that support 'marker' """ """ Adds paging to boto retrieval functions that support a 'marker'
this is configurable as not all boto functions seem to use the
same name.
"""
def wrapper(f): def wrapper(f):
def page(*args, **kwargs): def page(*args, **kwargs):
results = [] results = []
@ -247,7 +250,7 @@ def paging(pause=0):
while True: while True:
try: try:
new = f(*args, marker=marker, **kwargs) new = f(*args, marker=marker, **kwargs)
marker = new.next_marker marker = getattr(new, marker_property)
results.extend(new) results.extend(new)
if not marker: if not marker:
break break