summaryrefslogtreecommitdiff
path: root/openstackclient/image
diff options
context:
space:
mode:
authorSteve Martinelli <s.martinelli@gmail.com>2016-12-02 16:14:42 +0000
committerFrode Nordahl <frode.nordahl@canonical.com>2016-12-05 10:35:00 +0100
commit42f33435ed36319552842674a96823b7c6e2164f (patch)
tree66d2942984fd9cceea902b21831d2c735a975d71 /openstackclient/image
parent307a847685a04de2e6df19722d3287e59e20d34d (diff)
downloadpython-openstackclient-42f33435ed36319552842674a96823b7c6e2164f.tar.gz
Revert "Remove marker and loop from "image list" command"
This reverts commit 0b6fdcbe4c3f3142fdd18bfd827653d894607941. Adapt "image list" to not loop when --marker is specified on command line. Update tests to work with current state of code. Change-Id: I8af58adf8637a9e34371c6280db40935d22bc3c3
Diffstat (limited to 'openstackclient/image')
-rw-r--r--openstackclient/image/v2/image.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index 4031952b..ac29da9c 100644
--- a/openstackclient/image/v2/image.py
+++ b/openstackclient/image/v2/image.py
@@ -485,7 +485,6 @@ class ListImage(command.Lister):
if parsed_args.marker:
kwargs['marker'] = utils.find_resource(image_client.images,
parsed_args.marker).id
-
if parsed_args.long:
columns = (
'ID',
@@ -518,7 +517,19 @@ class ListImage(command.Lister):
column_headers = columns
# List of image data received
- data = image_client.api.image_list(**kwargs)
+ data = []
+ if 'marker' in kwargs:
+ data = image_client.api.image_list(**kwargs)
+ else:
+ # No pages received yet, so start the page marker at None.
+ marker = None
+ while True:
+ page = image_client.api.image_list(marker=marker, **kwargs)
+ if not page:
+ break
+ data.extend(page)
+ # Set the marker to the id of the last item we received
+ marker = page[-1]['id']
if parsed_args.property:
# NOTE(dtroyer): coerce to a list to subscript it in py3