Skip to content

Commit 09e00c0

Browse files
committed
Solved comments
1 parent 83a4f29 commit 09e00c0

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

SoftLayer/CLI/object_storage/list_endpoints.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,17 @@ def cli(env, identifier):
1919

2020
final_end_points = []
2121

22-
table = formatting.Table(['Legacy', 'EndPoint Type', 'Public/Private', 'Location/Region', 'Url'])
22+
table = formatting.Table(['Location/Region', 'Url', 'EndPoint Type', 'Public/Private', 'Legacy'])
23+
table.align['Location/Region'] = 'l'
24+
table.align['Url'] = 'l'
2325
for endpoint in endpoints:
24-
data = [endpoint['legacy'], end_point_return(endpoint['region']), public_private(endpoint['type']),
25-
location_region(endpoint), endpoint['url']]
26+
data = {
27+
'Location/Region': location_region(endpoint),
28+
'Url': endpoint['url'],
29+
'EndPoint Type': end_point_return(endpoint['region']),
30+
'Public/Private': public_private(endpoint['type']),
31+
'Legacy': endpoint['legacy']
32+
}
2633
final_end_points.append(data)
2734

2835
final_end_points = sort_endpoint(final_end_points)
@@ -34,7 +41,11 @@ def cli(env, identifier):
3441
def add_array_to_table(table, array_datas):
3542
"""Add an array to a table"""
3643
for array in array_datas:
37-
table.add_row([array[0], array[1], array[2], array[3], array[4]])
44+
table.add_row([array['Location/Region'],
45+
array['Url'],
46+
array['EndPoint Type'],
47+
array['Public/Private'],
48+
array['Legacy']])
3849
return table
3950

4051

@@ -63,19 +74,20 @@ def location_region(endpoint):
6374

6475
def sort_endpoint(endpoints):
6576
"""Sort the all endpoints for public or private"""
77+
first_data = 0
6678
endpoint_type = ''
6779
if len(endpoints) > 0:
68-
endpoint_type = endpoints[0][1]
80+
endpoint_type = endpoints[first_data]['EndPoint Type']
6981
public = []
7082
private = []
7183
array_final = []
7284
for endpoint in endpoints:
73-
if endpoint[1] != endpoint_type:
74-
endpoint_type = endpoint[1]
85+
if endpoint['EndPoint Type'] != endpoint_type:
86+
endpoint_type = endpoint['EndPoint Type']
7587
array_final = array_final + public + private
7688
public.clear()
7789
private.clear()
78-
if endpoint[2] == 'Public':
90+
if endpoint['Public/Private'] == 'Public':
7991
public.append(endpoint)
8092
else:
8193
private.append(endpoint)

0 commit comments

Comments
 (0)