Skip to content

Commit 9083aba

Browse files
caberoscaberos
authored andcommitted
fix the team code review comments
1 parent 68fa92e commit 9083aba

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

SoftLayer/CLI/order/package_locations.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
from SoftLayer.CLI import environment
66
from SoftLayer.CLI import formatting
7+
from SoftLayer.managers import network
78
from SoftLayer.managers import ordering
89

9-
COLUMNS = ['id', 'dc', 'description', 'keyName']
10+
COLUMNS = ['id', 'dc', 'description', 'keyName', 'note']
1011

1112

1213
@click.command()
@@ -18,15 +19,26 @@ def cli(env, package_keyname):
1819
Use the location Key Name to place orders
1920
"""
2021
manager = ordering.OrderingManager(env.client)
22+
network_manager = network.NetworkManager(env.client)
23+
24+
pods = network_manager.get_closed_pods()
2125
table = formatting.Table(COLUMNS)
2226

2327
locations = manager.package_locations(package_keyname)
2428
for region in locations:
2529
for datacenter in region['locations']:
30+
closure = []
31+
for pod in pods:
32+
if datacenter['location']['name'] in str(pod['name']):
33+
closure.append(pod['name'])
34+
35+
notes = '-'
36+
if len(closure) > 0:
37+
notes = 'closed soon: %s' % (', '.join(closure))
2638
table.add_row([
2739
datacenter['location']['id'],
2840
datacenter['location']['name'],
2941
region['description'],
30-
region['keyname']
42+
region['keyname'], notes
3143
])
3244
env.fout(table)

tests/CLI/modules/order_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ def test_location_list(self):
309309
result = self.run_command(['order', 'package-locations', 'package'])
310310
self.assert_no_fail(result)
311311
expected_results = [
312-
{'id': 2017603, 'dc': 'wdc07', 'description': 'WDC07 - Washington, DC', 'keyName': 'WASHINGTON07'}
312+
{'id': 2017603, 'dc': 'wdc07', 'description': 'WDC07 - Washington, DC',
313+
'keyName': 'WASHINGTON07','note': 'closed soon: wdc07.pod01'}
313314
]
314315
print("FUCK")
315316
print(result.output)

0 commit comments

Comments
 (0)