File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff 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' ):
Original file line number Diff line number Diff line change 99from 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
You can’t perform that action at this time.
0 commit comments