libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [libcloud] Kami commented on a change in pull request #1467: Fix OpenStack image v2 pagination handling
Date Fri, 12 Jun 2020 13:25:29 GMT

Kami commented on a change in pull request #1467:
URL: https://github.com/apache/libcloud/pull/1467#discussion_r439416322



##########
File path: libcloud/compute/drivers/openstack.py
##########
@@ -2862,10 +2862,14 @@ def list_images(self, location=None, ex_only_active=True):
             raise NotImplementedError(
                 "ex_only_active in list_images is not implemented "
                 "in the OpenStack_2_NodeDriver")
-        response = self.image_connection.request('/v2/images')
         images = []
-        for image in response.object['images']:
-            images.append(self._to_image(image))
+        path = '/v2/images'
+        while path:

Review comment:
       I'm a bit worried in this loop potentially never terminating if API returns an invalid
response (aka incorrectly includes ``next`` attribute or similar).
   
   It looks like we already "_paginated_request" utility method which should handle that scenario
(https://github.com/apache/libcloud/blob/6da1d6be5fcec4d25ff71b6cbfbf78f409283888/libcloud/compute/drivers/openstack.py#L176).
   
   So probably we should utilize it here as well.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message