@@ -22,7 +22,7 @@ def cli(env, prices, location=None):
2222 """List all options for ordering a block storage"""
2323
2424 order_manager = SoftLayer .OrderingManager (env .client )
25- items = order_manager .get_items (PACKAGE_STORAGE )
25+ items = order_manager .get_items (PACKAGE_STORAGE , mask = "mask[categories]" )
2626 datacenters = order_manager .get_regions (PACKAGE_STORAGE , location )
2727
2828 tables = []
@@ -67,7 +67,7 @@ def _block_ios_get_table(items, prices):
6767 if block_item ['itemCategory' ]['categoryCode' ] == 'storage_tier_level' :
6868 table .add_row ([block_item .get ('id' ), block_item .get ('description' ),
6969 block_item .get ('keyName' )])
70- table .sortby = 'Id '
70+ table .sortby = 'KeyName '
7171 table .align = 'l'
7272 return table
7373
@@ -86,7 +86,7 @@ def _block_storage_table(items, prices):
8686 if block_item ['itemCategory' ]['categoryCode' ] == 'performance_storage_space' :
8787 table .add_row ([block_item .get ('id' ), block_item .get ('description' ),
8888 block_item .get ('keyName' ), block_item .get ('capacityMinimum' ) or '-' , ])
89- table .sortby = 'Id '
89+ table .sortby = 'KeyName '
9090 table .align = 'l'
9191 return table
9292
@@ -101,9 +101,16 @@ def _block_snapshot_get_table(items, prices):
101101 else :
102102 table = formatting .Table (['Id' , 'Description' , 'KeyName' ], title = 'Snapshot' )
103103 for block_item in items :
104- if block_item ['itemCategory' ]['categoryCode' ] == 'storage_snapshot_space' :
105- table .add_row ([block_item .get ('id' ), block_item .get ('description' ),
106- block_item .get ('keyName' )])
107- table .sortby = 'Id'
104+ if is_snapshot_category (block_item .get ('categories' , [])):
105+ table .add_row ([block_item .get ('id' ), block_item .get ('description' ), block_item .get ('keyName' )])
106+ table .sortby = 'KeyName'
108107 table .align = 'l'
109108 return table
109+
110+
111+ def is_snapshot_category (categories ):
112+ """Checks if storage_snapshot_space is one of the categories"""
113+ for item in categories :
114+ if item .get ('categoryCode' ) == "storage_snapshot_space" :
115+ return True
116+ return False
0 commit comments