File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed
Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -42,14 +42,17 @@ def list_endpoints(self):
4242 'hubNetworkStorage' : {'vendorName' : {'operation' : 'Swift' }},
4343 }
4444 endpoints = []
45- for node in self .client .call ('Account' , 'getHubNetworkStorage' ,
46- mask = ENDPOINT_MASK ,
47- limit = 1 ,
48- filter = _filter )['storageNodes' ]:
49- endpoints .append ({
50- 'datacenter' : node ['datacenter' ],
51- 'public' : node ['frontendIpAddress' ],
52- 'private' : node ['backendIpAddress' ],
53- })
45+ network_storage = self .client .call ('Account' ,
46+ 'getHubNetworkStorage' ,
47+ mask = ENDPOINT_MASK ,
48+ limit = 1 ,
49+ filter = _filter )
50+ if network_storage :
51+ for node in network_storage ['storageNodes' ]:
52+ endpoints .append ({
53+ 'datacenter' : node ['datacenter' ],
54+ 'public' : node ['frontendIpAddress' ],
55+ 'private' : node ['backendIpAddress' ],
56+ })
5457
5558 return endpoints
Original file line number Diff line number Diff line change @@ -33,3 +33,12 @@ def test_list_endpoints(self):
3333 [{'datacenter' : {'name' : 'dal05' },
3434 'private' : 'https://dal05/auth/v1.0/' ,
3535 'public' : 'https://dal05/auth/v1.0/' }])
36+
37+ def test_list_endpoints_no_results (self ):
38+ accounts = self .set_mock ('SoftLayer_Account' , 'getHubNetworkStorage' )
39+ accounts .return_value = {
40+ 'storageNodes' : [],
41+ }
42+ endpoints = self .object_storage .list_endpoints ()
43+ self .assertEqual (endpoints ,
44+ [])
You can’t perform that action at this time.
0 commit comments