Skip to content

Commit 7374993

Browse files
author
Brian Flores
committed
added new columns
1 parent e03d17b commit 7374993

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

SoftLayer/CLI/image/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from SoftLayer.CLI import formatting
44

55

6-
MASK = ('id,accountId,name,globalIdentifier,parentId,publicFlag,flexImageFlag,'
7-
'imageType')
6+
MASK = ('id,createDate,note,accountId,name,globalIdentifier,parentId,publicFlag,flexImageFlag,'
7+
'imageType,children[blockDevices[diskImage[softwareReferences[softwareDescription]]]]')
88
DETAIL_MASK = MASK + (',firstChild,children[id,blockDevicesDiskSpaceTotal,datacenter,'
99
'transaction[transactionGroup,transactionStatus]],'
1010
'note,createDate,status,transaction')

SoftLayer/CLI/image/list.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,18 @@ def cli(env, name, public):
2929
for image in image_mgr.list_public_images(name=name, mask=image_mod.MASK):
3030
images.append(image)
3131

32-
table = formatting.Table(['id', 'name', 'type', 'visibility', 'account'])
32+
table = formatting.Table(['id', 'name', 'type', 'visibility', 'account', 'os', 'created', 'notes'])
3333

3434
images = [image for image in images if not image['parentId']]
3535
for image in images:
36-
36+
operative_system = '-'
37+
if image.get('children') and len(image.get('children')) != 0:
38+
if image.get('children')[0].get('blockDevices') and len(image.get('children')[0].get('blockDevices')) != 0:
39+
for block_device in image.get('children')[0].get('blockDevices'):
40+
if block_device.get('diskImage').get('softwareReferences') and \
41+
len(block_device.get('diskImage').get('softwareReferences')) != 0:
42+
operative_system = block_device.get('diskImage').get('softwareReferences')[0].\
43+
get('softwareDescription').get('longDescription')
3744
visibility = (image_mod.PUBLIC_TYPE if image['publicFlag'] else image_mod.PRIVATE_TYPE)
3845
table.add_row([
3946
image.get('id', formatting.blank()),
@@ -43,6 +50,9 @@ def cli(env, name, public):
4350
utils.lookup(image, 'imageType', 'name')),
4451
visibility,
4552
image.get('accountId', formatting.blank()),
53+
operative_system,
54+
image.get('createDate', formatting.blank()),
55+
image.get('note', formatting.blank()),
4656
])
4757

4858
env.fout(table)

0 commit comments

Comments
 (0)