Repository: libcloud Updated Branches: refs/heads/trunk 3b515f4ef -> 095db8bfd
[google compute] List images fix for projects > 500 images. Closes #939 Signed-off-by: Eric Johnson <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/095db8bf Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/095db8bf Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/095db8bf Branch: refs/heads/trunk Commit: 095db8bfd63e35a5bfd4d8ac2c0465525fb2183a Parents: 3b515f4 Author: Scott Crunkleton <[email protected]> Authored: Mon Nov 7 18:35:07 2016 -0800 Committer: Eric Johnson <[email protected]> Committed: Tue Nov 8 14:09:07 2016 +0000 ---------------------------------------------------------------------- CHANGES.rst | 4 ++++ libcloud/compute/drivers/gce.py | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/095db8bf/CHANGES.rst ---------------------------------------------------------------------- diff --git a/CHANGES.rst b/CHANGES.rst index 7d0f290..0f1a24e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,10 @@ Changes in current version of Apache Libcloud Compute ~~~~~~~ +- [google compute] List images fix for projects > 500 images. + (GITHUB-939) + [Scott Crunkleton] + - [ec2] Add st1 and sc1 volume types to valid types (GITHUB-925) [Sean Goller] http://git-wip-us.apache.org/repos/asf/libcloud/blob/095db8bf/libcloud/compute/drivers/gce.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py index 7eaffd3..be22d28 100644 --- a/libcloud/compute/drivers/gce.py +++ b/libcloud/compute/drivers/gce.py @@ -7326,16 +7326,18 @@ class GCENodeDriver(NodeDriver): if no matching image is found. :rtype: :class:`GCENodeImage` or ``None`` """ - project_images = self.list_images(ex_project=project, - ex_include_deprecated=True) + project_images_pages = self.ex_list( + self.list_images, ex_project=project, ex_include_deprecated=True) partial_match = [] - for image in project_images: - if image.name == partial_name: - return image - if image.name.startswith(partial_name): - ts = timestamp_to_datetime(image.extra['creationTimestamp']) - if not partial_match or partial_match[0] < ts: - partial_match = [ts, image] + for page in project_images_pages: + for image in page: + if image.name == partial_name: + return image + if image.name.startswith(partial_name): + ts = timestamp_to_datetime( + image.extra['creationTimestamp']) + if not partial_match or partial_match[0] < ts: + partial_match = [ts, image] if partial_match: return partial_match[1]
