Fix Glance API pagination polling
Change-Id: I520563f195afc81cf3c9600ca1a8cafd97fa0940
This commit is contained in:
parent
5f4cab9047
commit
97201abd78
|
@ -351,21 +351,18 @@ class CollectdPlugin(base.Base):
|
||||||
|
|
||||||
_objects.extend(bulk_objs)
|
_objects.extend(bulk_objs)
|
||||||
|
|
||||||
links = resp.get('{}_links'.format(object_name))
|
if self.pagination_limit is None:
|
||||||
if links is None or self.pagination_limit is None:
|
|
||||||
# Either the pagination is not supported or there is
|
|
||||||
# no more data
|
|
||||||
# In both cases, we got at this stage all the data we
|
|
||||||
# can have.
|
|
||||||
break
|
break
|
||||||
|
|
||||||
# if there is no 'next' link in the response, all data has
|
links = resp.get('{}_links'.format(object_name), [])
|
||||||
# been read.
|
has_next = len(
|
||||||
if len([i for i in links if i.get('rel') == 'next']) == 0:
|
[i for i in links if i.get('rel') == 'next']) > 0 or \
|
||||||
|
resp.get('next')
|
||||||
|
if has_next:
|
||||||
|
_opts['marker'] = bulk_objs[-1]['id']
|
||||||
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
_opts['marker'] = bulk_objs[-1]['id']
|
|
||||||
|
|
||||||
if not has_failure:
|
if not has_failure:
|
||||||
self._last_run = last_run
|
self._last_run = last_run
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue