summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-06-22 04:52:27 +0000
committerGerrit Code Review <review@openstack.org>2015-06-22 04:52:27 +0000
commitcc38f51086b930a05c0abecf6c9e00fdf5c294f6 (patch)
treec63966858b7c4011a3bdf6d1881dc193a4e370be
parentdc3dd87de925e165faa1d79fd457a2ffa53b801c (diff)
parentea01f13be21f0243711bc8eef6d84ecba39d7164 (diff)
downloadpython-glanceclient-cc38f51086b930a05c0abecf6c9e00fdf5c294f6.tar.gz
Merge "Add v2 support for the marker attribute"
-rw-r--r--glanceclient/tests/unit/v2/test_images.py6
-rw-r--r--glanceclient/v2/images.py3
2 files changed, 9 insertions, 0 deletions
diff --git a/glanceclient/tests/unit/v2/test_images.py b/glanceclient/tests/unit/v2/test_images.py
index 26ee792..7260f47 100644
--- a/glanceclient/tests/unit/v2/test_images.py
+++ b/glanceclient/tests/unit/v2/test_images.py
@@ -555,6 +555,12 @@ class TestController(testtools.TestCase):
self.assertEqual('image-3', images[2].name)
self.assertEqual(3, len(images))
+ def test_list_images_with_marker(self):
+ images = list(self.controller.list(limit=1,
+ marker='3a4560a1-e585-443e-9b39-553b46ec92d1'))
+ self.assertEqual('6f99bf80-2ee6-47cf-acfe-1f1fabb7e810', images[0].id)
+ self.assertEqual('image-2', images[0].name)
+
def test_list_images_visibility_public(self):
filters = {'filters': {'visibility': 'public'}}
images = list(self.controller.list(**filters))
diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py
index 01ce40b..0cbd0d5 100644
--- a/glanceclient/v2/images.py
+++ b/glanceclient/v2/images.py
@@ -168,6 +168,9 @@ class Controller(object):
for dir in sort_dir:
url = '%s&sort_dir=%s' % (url, dir)
+ if isinstance(kwargs.get('marker'), six.string_types):
+ url = '%s&marker=%s' % (url, kwargs['marker'])
+
for image in paginate(url, page_size, limit):
yield image