Skip to content

Commit d205fee

Browse files
committed
Added get lbaas by address method
1 parent be19a02 commit d205fee

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

SoftLayer/managers/load_balancer.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,20 @@ def get_lbaas_uuid_id(self, identifier):
100100
this_lb = self.lbaas.getLoadBalancer(identifier, mask="mask[id,uuid]")
101101
else:
102102
this_lb = self.lbaas.getObject(id=identifier, mask="mask[id,uuid]")
103-
return this_lb['uuid'], this_lb['id']
103+
return this_lb.get('uuid'), this_lb.get('id')
104+
105+
def get_lbaas_by_address(self, address):
106+
"""Gets a LBaaS by address.
107+
108+
:param address: Address of the LBaaS instance
109+
"""
110+
this_lb = {}
111+
this_lbs = self.lbaas.getAllObjects()
112+
for lbaas in this_lbs:
113+
if lbaas.get('address') == address:
114+
this_lb = lbaas
115+
break
116+
return this_lb
104117

105118
def delete_lb_member(self, identifier, member_id):
106119
"""Removes a member from a LBaaS instance

0 commit comments

Comments
 (0)