Kami commented on a change in pull request #1409: [WIP] Fix pagination in the
"list_nodes()" method in the GCE driver
URL: https://github.com/apache/libcloud/pull/1409#discussion_r366173417
##########
File path: libcloud/compute/drivers/gce.py
##########
@@ -2569,50 +2586,35 @@ def list_nodes(self, ex_zone=None,
ex_use_disk_cache=True):
:return: List of Node objects
:rtype: ``list`` of :class:`Node`
"""
- list_nodes = []
zone = self._set_zone(ex_zone)
- if zone is None:
- request = '/aggregated/instances'
- else:
- request = '/zones/%s/instances' % (zone.name)
- response = self.connection.request(request, method='GET').object
+ response = self.connection.request_aggregated_items('instances',
+ zone=zone)
+
+ if not response.get('items', []):
Review comment:
This return early change is purely for style purpose so we can make the code
a bit easier to read and get rid of one level of indentation on "happy" code
path when response contains results.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services