From 09fd29a9cc29904679cc8921adaf7559c23f347f Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Tue, 30 Aug 2011 14:52:23 -0400 Subject: fixing short-ciruit condition --- nova/image/glance.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nova/image/glance.py b/nova/image/glance.py index f2f246ba6..b5f52351f 100644 --- a/nova/image/glance.py +++ b/nova/image/glance.py @@ -141,12 +141,13 @@ class GlanceImageService(service.BaseImageService): """Paginate through results from glance server""" images = fetch_func(**kwargs) - for image in images: - yield image - else: + if not images: # break out of recursive loop to end pagination return + for image in images: + yield image + try: # attempt to advance the marker in order to fetch next page kwargs['marker'] = images[-1]['id'] -- cgit