Skip to content

Commit e029225

Browse files
caberoscaberos
authored andcommitted
slcli image list should use an iterative cal
1 parent 36d7c19 commit e029225

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

SoftLayer/CLI/image/list.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,23 @@
1414
@click.option('--name', default=None, help='Filter on image name')
1515
@click.option('--public/--private', is_flag=True, default=None,
1616
help='Display only public or private images')
17+
@click.option('--limit', '-l',
18+
help='How many results to get in one api call',
19+
default=100,
20+
show_default=True)
1721
@environment.pass_env
18-
def cli(env, name, public):
22+
def cli(env, name, public, limit):
1923
"""List images."""
2024

2125
image_mgr = SoftLayer.ImageManager(env.client)
2226

2327
images = []
2428
if public in [False, None]:
25-
for image in image_mgr.list_private_images(name=name, mask=image_mod.MASK):
29+
for image in image_mgr.list_private_images(name=name, limit=limit, mask=image_mod.MASK):
2630
images.append(image)
2731

2832
if public in [True, None]:
29-
for image in image_mgr.list_public_images(name=name, mask=image_mod.MASK):
33+
for image in image_mgr.list_public_images(name=name, limit=limit, mask=image_mod.MASK):
3034
images.append(image)
3135

3236
table = formatting.Table(['Id', 'Name', 'Type', 'Visibility', 'Account', 'OS', 'Created', 'Notes'])

SoftLayer/managers/image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def delete_image(self, image_id):
4646
"""
4747
self.vgbdtg.deleteObject(id=image_id)
4848

49-
def list_private_images(self, guid=None, name=None, **kwargs):
49+
def list_private_images(self, guid=None, name=None, limit=100, **kwargs):
5050
"""List all private images.
5151
5252
:param string guid: filter based on GUID
@@ -68,7 +68,7 @@ def list_private_images(self, guid=None, name=None, **kwargs):
6868
kwargs['filter'] = _filter.to_dict()
6969

7070
account = self.client['Account']
71-
return account.getPrivateBlockDeviceTemplateGroups(**kwargs)
71+
return account.getPrivateBlockDeviceTemplateGroups(**kwargs, limit=limit)
7272

7373
def list_public_images(self, guid=None, name=None, limit=100, **kwargs):
7474
"""List all public images.

0 commit comments

Comments
 (0)