libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r1102994 - in /incubator/libcloud/trunk: libcloud/loadbalancer/base.py libcloud/loadbalancer/drivers/gogrid.py libcloud/loadbalancer/drivers/rackspace.py test/loadbalancer/test_gogrid.py test/loadbalancer/test_rackspace.py
Date Sat, 14 May 2011 09:57:45 GMT
Author: pquerna
Date: Sat May 14 09:57:45 2011
New Revision: 1102994

URL: http://svn.apache.org/viewvc?rev=1102994&view=rev
Log:
Have attach_member actually take a LBMember object as its parameter, rather than a raw ip/port

Modified:
    incubator/libcloud/trunk/libcloud/loadbalancer/base.py
    incubator/libcloud/trunk/libcloud/loadbalancer/drivers/gogrid.py
    incubator/libcloud/trunk/libcloud/loadbalancer/drivers/rackspace.py
    incubator/libcloud/trunk/test/loadbalancer/test_gogrid.py
    incubator/libcloud/trunk/test/loadbalancer/test_rackspace.py

Modified: incubator/libcloud/trunk/libcloud/loadbalancer/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/loadbalancer/base.py?rev=1102994&r1=1102993&r2=1102994&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/loadbalancer/base.py (original)
+++ incubator/libcloud/trunk/libcloud/loadbalancer/base.py Sat May 14 09:57:45 2011
@@ -53,8 +53,8 @@ class LB(object):
         self.port = port
         self.driver = driver
 
-    def attach_member(self, **kwargs):
-        return self.driver.balancer_attach_member(self, **kwargs)
+    def attach_member(self, member):
+        return self.driver.balancer_attach_member(self, member)
 
     def detach_member(self, member):
         return self.driver.balancer_detach_member(self, member)

Modified: incubator/libcloud/trunk/libcloud/loadbalancer/drivers/gogrid.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/loadbalancer/drivers/gogrid.py?rev=1102994&r1=1102993&r2=1102994&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/loadbalancer/drivers/gogrid.py (original)
+++ incubator/libcloud/trunk/libcloud/loadbalancer/drivers/gogrid.py Sat May 14 09:57:45 2011
@@ -102,12 +102,9 @@ class GoGridLBDriver(BaseGoGridDriver, L
 
         return self._to_balancers(resp.object)[0]
 
-    def balancer_attach_member(self, balancer, **kwargs):
-        ip = kwargs['ip']
-        port = kwargs['port']
-
+    def balancer_attach_member(self, balancer, member):
         members = self.balancer_list_members(balancer)
-        members.append(LBMember(None, ip, port))
+        members.append(member)
 
         params = {"id": balancer.id}
 
@@ -115,9 +112,9 @@ class GoGridLBDriver(BaseGoGridDriver, L
 
         resp = self._update_balancer(params)
 
-        return [ member for member in
+        return [ m for m in
                 self._to_members(resp.object["list"][0]["realiplist"])
-                if member.ip == ip ][0]
+                if m.ip == member.ip ][0]
 
     def balancer_detach_member(self, balancer, member):
         members = self.balancer_list_members(balancer)

Modified: incubator/libcloud/trunk/libcloud/loadbalancer/drivers/rackspace.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/loadbalancer/drivers/rackspace.py?rev=1102994&r1=1102993&r2=1102994&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/loadbalancer/drivers/rackspace.py (original)
+++ incubator/libcloud/trunk/libcloud/loadbalancer/drivers/rackspace.py Sat May 14 09:57:45
2011
@@ -114,9 +114,9 @@ class RackspaceLBDriver(LBDriver):
 
         return self._to_balancer(resp.object["loadBalancer"])
 
-    def balancer_attach_member(self, balancer, **kwargs):
-        ip = kwargs['ip']
-        port = kwargs['port']
+    def balancer_attach_member(self, balancer, member):
+        ip = member.ip
+        port = member.port
 
         member_object = {"nodes":
                 [{"port": port,

Modified: incubator/libcloud/trunk/test/loadbalancer/test_gogrid.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/loadbalancer/test_gogrid.py?rev=1102994&r1=1102993&r2=1102994&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/loadbalancer/test_gogrid.py (original)
+++ incubator/libcloud/trunk/test/loadbalancer/test_gogrid.py Sat May 14 09:57:45 2011
@@ -62,7 +62,7 @@ class GoGridTests(unittest.TestCase):
     def test_balancer_attach_member(self):
         balancer = LB(23530, None, None, None, None, None)
         member = self.driver.balancer_attach_member(balancer,
-                ip='10.0.0.75', port='80')
+                LBMember(None, ip='10.0.0.75', port='80'))
 
         self.assertEquals(member.ip, '10.0.0.75')
         self.assertEquals(member.port, 80)

Modified: incubator/libcloud/trunk/test/loadbalancer/test_rackspace.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/loadbalancer/test_rackspace.py?rev=1102994&r1=1102993&r2=1102994&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/loadbalancer/test_rackspace.py (original)
+++ incubator/libcloud/trunk/test/loadbalancer/test_rackspace.py Sat May 14 09:57:45 2011
@@ -58,7 +58,7 @@ class RackspaceLBTests(unittest.TestCase
 
     def test_balancer_attach_member(self):
         balancer = self.driver.balancer_detail(balancer_id='8290')
-        member = balancer.attach_member(ip='10.1.0.12', port='80')
+        member = balancer.attach_member(LBMember(None, ip='10.1.0.12', port='80'))
 
         self.assertEquals(member.ip, '10.1.0.12')
         self.assertEquals(member.port, 80)



Mime
View raw message