summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSwann Croiset <scroiset@mirantis.com>2017-03-06 17:51:37 +0100
committerSwann Croiset <scroiset@mirantis.com>2017-03-09 14:34:41 +0100
commit97201abd7856a5c835298e743f39ff61e03b6fe1 (patch)
treefe76f91615e2276ec2b4567281fc995e650c9a84
parent5f4cab904785e3e1b078bd90f4e9c0d29473da85 (diff)
Fix Glance API pagination polling
Notes
Notes (review): Code-Review+2: Simon Pasquier <spasquier@mirantis.com> Workflow+1: Swann Croiset <scroiset@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 13 Mar 2017 09:37:46 +0000 Reviewed-on: https://review.openstack.org/442036 Project: openstack/fuel-plugin-lma-collector Branch: refs/heads/master
-rw-r--r--deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py b/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py
index 2da8670..2013b30 100644
--- a/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py
+++ b/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py
@@ -351,21 +351,18 @@ class CollectdPlugin(base.Base):
351 351
352 _objects.extend(bulk_objs) 352 _objects.extend(bulk_objs)
353 353
354 links = resp.get('{}_links'.format(object_name)) 354 if self.pagination_limit is None:
355 if links is None or self.pagination_limit is None:
356 # Either the pagination is not supported or there is
357 # no more data
358 # In both cases, we got at this stage all the data we
359 # can have.
360 break 355 break
361 356
362 # if there is no 'next' link in the response, all data has 357 links = resp.get('{}_links'.format(object_name), [])
363 # been read. 358 has_next = len(
364 if len([i for i in links if i.get('rel') == 'next']) == 0: 359 [i for i in links if i.get('rel') == 'next']) > 0 or \
360 resp.get('next')
361 if has_next:
362 _opts['marker'] = bulk_objs[-1]['id']
363 else:
365 break 364 break
366 365
367 _opts['marker'] = bulk_objs[-1]['id']
368
369 if not has_failure: 366 if not has_failure:
370 self._last_run = last_run 367 self._last_run = last_run
371 368