Browse Source

Merge "Fix Glance API pagination polling"

changes/71/446971/1
Jenkins 2 years ago
parent
commit
ab344cbc52

+ 8
- 11
deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py View File

@@ -351,21 +351,18 @@ class CollectdPlugin(base.Base):
351 351
 
352 352
                 _objects.extend(bulk_objs)
353 353
 
354
-                links = resp.get('{}_links'.format(object_name))
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.
354
+                if self.pagination_limit is None:
360 355
                     break
361 356
 
362
-                # if there is no 'next' link in the response, all data has
363
-                # been read.
364
-                if len([i for i in links if i.get('rel') == 'next']) == 0:
357
+                links = resp.get('{}_links'.format(object_name), [])
358
+                has_next = len(
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 364
                     break
366 365
 
367
-                _opts['marker'] = bulk_objs[-1]['id']
368
-
369 366
             if not has_failure:
370 367
                 self._last_run = last_run
371 368
 

Loading…
Cancel
Save