Skip to content

Commit f8d8e11

Browse files
Merge pull request #1907 from caberos/issue1902
Issues with block/file volume-details on some volumes
2 parents 182f7b3 + 78239ec commit f8d8e11

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

SoftLayer/CLI/block/detail.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ def cli(env, volume_id):
2323
table.align['Name'] = 'r'
2424
table.align['Value'] = 'l'
2525

26+
capacity = '0'
27+
if block_volume['capacityGb'] != '':
28+
capacity = "%iGB" % block_volume['capacityGb']
2629
storage_type = block_volume['storageType']['keyName'].split('_').pop(0)
2730
table.add_row(['ID', block_volume['id']])
2831
table.add_row(['Username', block_volume['username']])
2932
table.add_row(['Type', storage_type])
30-
table.add_row(['Capacity (GB)', "%iGB" % block_volume['capacityGb']])
33+
table.add_row(['Capacity (GB)', capacity])
3134
table.add_row(['LUN Id', "%s" % block_volume['lunId']])
3235

3336
if block_volume.get('provisionedIops'):

SoftLayer/CLI/file/detail.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
from SoftLayer import utils
1010

1111

12+
def get_capacity(file_volume):
13+
"""Get the capacity Gb with validate the data"""
14+
capacity = '0'
15+
if file_volume['capacityGb'] != '':
16+
capacity = "%iGB" % file_volume['capacityGb']
17+
return capacity
18+
19+
1220
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1321
@click.argument('volume_id')
1422
@environment.pass_env
@@ -27,7 +35,7 @@ def cli(env, volume_id):
2735
table.add_row(['ID', file_volume['id']])
2836
table.add_row(['Username', file_volume['username']])
2937
table.add_row(['Type', storage_type])
30-
table.add_row(['Capacity (GB)', "%iGB" % file_volume['capacityGb']])
38+
table.add_row(['Capacity (GB)', get_capacity(file_volume)])
3139

3240
used_space = int(file_volume['bytesUsed']) \
3341
if file_volume['bytesUsed'] else 0

0 commit comments

Comments
 (0)