Skip to content

Commit 926f481

Browse files
caberoscaberos
authored andcommitted
block/file volume-options improvements 2
1 parent ce76700 commit 926f481

File tree

2 files changed

+38
-14
lines changed

2 files changed

+38
-14
lines changed

SoftLayer/CLI/block/options.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,27 @@ def cli(env):
2020
items = order_manager.get_items(PACKAGE_STORAGE)
2121
datacenters = order_manager.get_regions(PACKAGE_STORAGE)
2222

23+
network = SoftLayer.NetworkManager(env.client)
24+
25+
pods = network.get_closed_pods()
26+
2327
iops_table = formatting.Table(['Id', 'Description', 'KeyName'], title='IOPS')
2428
snapshot_table = formatting.Table(['Id', 'Description', 'KeyName'], title='Snapshot')
2529
storage_table = formatting.Table(['Id', 'Description', 'KeyName'], title='Storage')
26-
datacenter_table = formatting.Table(['Id', 'Description', 'KeyName'], title='Datacenter')
30+
datacenter_table = formatting.Table(['Id', 'Description', 'KeyName', 'Notes'], title='Datacenter')
2731

2832
for datacenter in datacenters:
33+
closure = []
34+
for pod in pods:
35+
if datacenter['location']['location']['name'] in str(pod['name']):
36+
closure.append(pod['name'])
37+
38+
notes = '-'
39+
if len(closure) > 0:
40+
notes = 'closed soon: %s' % (', '.join(closure))
2941
datacenter_table.add_row([datacenter['location']['locationId'],
3042
datacenter.get('description'),
31-
datacenter['keyname']])
43+
datacenter['keyname'], notes])
3244

3345
for item in items:
3446
if item['itemCategory']['categoryCode'] == 'performance_storage_space':

SoftLayer/CLI/file/options.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,40 @@ def cli(env):
2121
items = order_manager.get_items(PACKAGE_STORAGE)
2222
datacenters = order_manager.get_regions(PACKAGE_STORAGE)
2323

24+
network = SoftLayer.NetworkManager(env.client)
25+
26+
pods = network.get_closed_pods()
27+
2428
iops_table = formatting.Table(['Id', 'Description', 'KeyName'], title='IOPS')
2529
snapshot_table = formatting.Table(['Id', 'Description', 'KeyName'], title='Snapshot')
2630
storage_table = formatting.Table(['Id', 'Description', 'KeyName'], title='Storage')
27-
datacenter_table = formatting.Table(['Id', 'Description', 'KeyName'], title='Datacenter')
31+
datacenter_table = formatting.Table(['Id', 'Description', 'KeyName', 'Notes'], title='Datacenter')
2832

2933
for datacenter in datacenters:
34+
closure = []
35+
for pod in pods:
36+
if datacenter['location']['location']['name'] in str(pod['name']):
37+
closure.append(pod['name'])
38+
39+
notes = '-'
40+
if len(closure) > 0:
41+
notes = 'closed soon: %s' % (', '.join(closure))
3042
datacenter_table.add_row([datacenter['location']['locationId'],
3143
datacenter.get('description'),
32-
datacenter['keyname']])
44+
datacenter['keyname'], notes])
3345

34-
for item in items:
35-
if item['itemCategory']['categoryCode'] == 'performance_storage_space':
36-
storage_table.add_row([item.get('id'), item.get('description'),
37-
item.get('keyName')])
46+
for item_file in items:
47+
if item_file['itemCategory']['categoryCode'] == 'performance_storage_space':
48+
storage_table.add_row([item_file.get('id'), item_file.get('description'),
49+
item_file.get('keyName')])
3850

39-
if item['itemCategory']['categoryCode'] == 'storage_tier_level':
40-
iops_table.add_row([item.get('id'), item.get('description'),
41-
item.get('keyName')])
51+
if item_file['itemCategory']['categoryCode'] == 'storage_tier_level':
52+
iops_table.add_row([item_file.get('id'), item_file.get('description'),
53+
item_file.get('keyName')])
4254

43-
if item['itemCategory']['categoryCode'] == 'storage_snapshot_space':
44-
snapshot_table.add_row([item.get('id'), item.get('description'),
45-
item.get('keyName')])
55+
if item_file['itemCategory']['categoryCode'] == 'storage_snapshot_space':
56+
snapshot_table.add_row([item_file.get('id'), item_file.get('description'),
57+
item_file.get('keyName')])
4658

4759
env.fout(datacenter_table)
4860
env.fout(iops_table)

0 commit comments

Comments
 (0)