Skip to content

Commit 34e4e1a

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Remove marker and loop from "image list" command"
2 parents e096965 + 0b6fdcb commit 34e4e1a

2 files changed

Lines changed: 5 additions & 25 deletions

File tree

openstackclient/image/v2/image.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,16 +474,7 @@ def take_action(self, parsed_args):
474474
column_headers = columns
475475

476476
# List of image data received
477-
data = []
478-
# No pages received yet, so start the page marker at None.
479-
marker = None
480-
while True:
481-
page = image_client.api.image_list(marker=marker, **kwargs)
482-
if not page:
483-
break
484-
data.extend(page)
485-
# Set the marker to the id of the last item we received
486-
marker = page[-1]['id']
477+
data = image_client.api.image_list(**kwargs)
487478

488479
if parsed_args.property:
489480
# NOTE(dtroyer): coerce to a list to subscript it in py3

openstackclient/tests/image/v2/test_image.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,7 @@ def test_image_list_no_options(self):
498498

499499
# DisplayCommandBase.take_action() returns two tuples
500500
columns, data = self.cmd.take_action(parsed_args)
501-
self.api_mock.image_list.assert_called_with(
502-
marker=image_fakes.image_id,
503-
)
501+
self.api_mock.image_list.assert_called_with()
504502

505503
self.assertEqual(self.columns, columns)
506504
self.assertEqual(self.datalist, tuple(data))
@@ -521,7 +519,6 @@ def test_image_list_public_option(self):
521519
columns, data = self.cmd.take_action(parsed_args)
522520
self.api_mock.image_list.assert_called_with(
523521
public=True,
524-
marker=image_fakes.image_id,
525522
)
526523

527524
self.assertEqual(self.columns, columns)
@@ -543,7 +540,6 @@ def test_image_list_private_option(self):
543540
columns, data = self.cmd.take_action(parsed_args)
544541
self.api_mock.image_list.assert_called_with(
545542
private=True,
546-
marker=image_fakes.image_id,
547543
)
548544

549545
self.assertEqual(self.columns, columns)
@@ -565,7 +561,6 @@ def test_image_list_shared_option(self):
565561
columns, data = self.cmd.take_action(parsed_args)
566562
self.api_mock.image_list.assert_called_with(
567563
shared=True,
568-
marker=image_fakes.image_id,
569564
)
570565

571566
self.assertEqual(self.columns, columns)
@@ -582,9 +577,7 @@ def test_image_list_long_option(self):
582577

583578
# DisplayCommandBase.take_action() returns two tuples
584579
columns, data = self.cmd.take_action(parsed_args)
585-
self.api_mock.image_list.assert_called_with(
586-
marker=image_fakes.image_id,
587-
)
580+
self.api_mock.image_list.assert_called_with()
588581

589582
collist = (
590583
'ID',
@@ -630,9 +623,7 @@ def test_image_list_property_option(self, sf_mock):
630623

631624
# DisplayCommandBase.take_action() returns two tuples
632625
columns, data = self.cmd.take_action(parsed_args)
633-
self.api_mock.image_list.assert_called_with(
634-
marker=image_fakes.image_id,
635-
)
626+
self.api_mock.image_list.assert_called_with()
636627
sf_mock.assert_called_with(
637628
[image_fakes.IMAGE],
638629
attr='a',
@@ -655,9 +646,7 @@ def test_image_list_sort_option(self, si_mock):
655646

656647
# DisplayCommandBase.take_action() returns two tuples
657648
columns, data = self.cmd.take_action(parsed_args)
658-
self.api_mock.image_list.assert_called_with(
659-
marker=image_fakes.image_id,
660-
)
649+
self.api_mock.image_list.assert_called_with()
661650
si_mock.assert_called_with(
662651
[image_fakes.IMAGE],
663652
'name:asc'

0 commit comments

Comments
 (0)