Skip to content

Commit 52365ba

Browse files
Merge branch 'issue1993' of github.com:caberos/softlayer-python into caberos-issue1993
2 parents 3f13fe8 + 7f33365 commit 52365ba

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
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: 3 additions & 3 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 self.client.iter_call('Virtual_Guest_Block_Device_Template_Group' , 'getPrivateBlockDeviceTemplateGroups', **kwargs, limit=limit)
7272

7373
def list_public_images(self, guid=None, name=None, limit=100, **kwargs):
7474
"""List all public images.
@@ -89,7 +89,7 @@ def list_public_images(self, guid=None, name=None, limit=100, **kwargs):
8989

9090
kwargs['filter'] = _filter.to_dict()
9191

92-
return self.vgbdtg.getPublicImages(**kwargs, limit=limit)
92+
return self.client.iter_call('Virtual_Guest_Block_Device_Template_Group', 'getPublicImages', **kwargs, limit=limit)
9393

9494
def _get_ids_from_name_public(self, name):
9595
"""Get public images which match the given name."""

0 commit comments

Comments
 (0)