libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1209949 - in /libcloud/branches/py3k: libcloud/loadbalancer/drivers/gogrid.py libcloud/loadbalancer/drivers/rackspace.py test/loadbalancer/test_cloudstack.py test/loadbalancer/test_gogrid.py test/loadbalancer/test_rackspace.py
Date Sat, 03 Dec 2011 17:02:07 GMT
Author: tomaz
Date: Sat Dec  3 17:02:06 2011
New Revision: 1209949

URL: http://svn.apache.org/viewvc?rev=1209949&view=rev
Log:
More progress. All the Loadbalancer tests now pass.

Modified:
    libcloud/branches/py3k/libcloud/loadbalancer/drivers/gogrid.py
    libcloud/branches/py3k/libcloud/loadbalancer/drivers/rackspace.py
    libcloud/branches/py3k/test/loadbalancer/test_cloudstack.py
    libcloud/branches/py3k/test/loadbalancer/test_gogrid.py
    libcloud/branches/py3k/test/loadbalancer/test_rackspace.py

Modified: libcloud/branches/py3k/libcloud/loadbalancer/drivers/gogrid.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/libcloud/loadbalancer/drivers/gogrid.py?rev=1209949&r1=1209948&r2=1209949&view=diff
==============================================================================
--- libcloud/branches/py3k/libcloud/loadbalancer/drivers/gogrid.py (original)
+++ libcloud/branches/py3k/libcloud/loadbalancer/drivers/gogrid.py Sat Dec  3 17:02:06 2011
@@ -112,8 +112,9 @@ class GoGridLBDriver(BaseGoGridDriver, D
         try:
             resp = self.connection.request('/api/grid/loadbalancer/delete',
                     method='POST', params={'id': balancer.id})
-        except Exception, err:
-            if "Update request for LoadBalancer" in str(err):
+        except Exception:
+            e = sys.exc_info()[1]
+            if "Update request for LoadBalancer" in str(e):
                 raise LibcloudLBImmutableError("Cannot delete immutable object",
                         GoGridLBDriver)
             else:
@@ -171,8 +172,9 @@ class GoGridLBDriver(BaseGoGridDriver, D
             return self.connection.request('/api/grid/loadbalancer/edit',
                     method='POST',
                     params=params)
-        except Exception, err:
-            if "Update already pending" in str(err):
+        except Exception:
+            e = sys.exc_info()[1]
+            if "Update already pending" in str(e):
                 raise LibcloudLBImmutableError("Balancer is immutable", GoGridLBDriver)
 
         raise LibcloudError(value='Exception: %s' % str(err), driver=self)

Modified: libcloud/branches/py3k/libcloud/loadbalancer/drivers/rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/libcloud/loadbalancer/drivers/rackspace.py?rev=1209949&r1=1209948&r2=1209949&view=diff
==============================================================================
--- libcloud/branches/py3k/libcloud/loadbalancer/drivers/rackspace.py (original)
+++ libcloud/branches/py3k/libcloud/loadbalancer/drivers/rackspace.py Sat Dec  3 17:02:06
2011
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 import os
+import binascii
 
 try:
     import simplejson as json
@@ -59,7 +60,7 @@ class RackspaceConnection(OpenStackBaseC
         if method in ('POST', 'PUT'):
             headers['Content-Type'] = 'application/json'
         if method == 'GET':
-            params['cache-busing'] = os.urandom(8).encode('hex')
+            params['cache-busing'] = binascii.hexlify(os.urandom(8))
 
         return super(RackspaceConnection, self).request(action=action,
                 params=params, data=data, method=method, headers=headers)

Modified: libcloud/branches/py3k/test/loadbalancer/test_cloudstack.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/test/loadbalancer/test_cloudstack.py?rev=1209949&r1=1209948&r2=1209949&view=diff
==============================================================================
--- libcloud/branches/py3k/test/loadbalancer/test_cloudstack.py (original)
+++ libcloud/branches/py3k/test/loadbalancer/test_cloudstack.py Sat Dec  3 17:02:06 2011
@@ -1,13 +1,14 @@
-import httplib
 import sys
 import unittest
-import urlparse
 
 try:
     import simplejson as json
 except ImportError:
     import json
 
+from libcloud.py3 import httplib
+from libcloud.py3 import urlparse
+
 try:
     parse_qsl = urlparse.parse_qsl
 except AttributeError:

Modified: libcloud/branches/py3k/test/loadbalancer/test_gogrid.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/test/loadbalancer/test_gogrid.py?rev=1209949&r1=1209948&r2=1209949&view=diff
==============================================================================
--- libcloud/branches/py3k/test/loadbalancer/test_gogrid.py (original)
+++ libcloud/branches/py3k/test/loadbalancer/test_gogrid.py Sat Dec  3 17:02:06 2011
@@ -13,10 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import httplib
 import sys
 import unittest
-from urlparse import urlparse
+
+from libcloud.py3 import httplib
+from libcloud.py3 import urlparse
 
 from libcloud.common.types import LibcloudError
 from libcloud.compute.base import Node
@@ -75,7 +76,8 @@ class GoGridTests(unittest.TestCase):
                     members=(Member(None, '10.1.0.10', 80),
                              Member(None, '10.1.0.11', 80))
                     )
-        except LibcloudError, e:
+        except LibcloudError:
+            e = sys.exc_info()[1]
             self.assertTrue(str(e).find('tried to add a member with an IP address not assigned
to your account') != -1)
         else:
             self.fail('Exception was not thrown')
@@ -100,8 +102,8 @@ class GoGridTests(unittest.TestCase):
         members1 = self.driver.balancer_list_members(balancer=balancer)
         members2 = balancer.list_members()
 
-        expected_members = set([u'10.0.0.78:80', u'10.0.0.77:80',
-            u'10.0.0.76:80'])
+        expected_members = set(['10.0.0.78:80', '10.0.0.77:80',
+                                '10.0.0.76:80'])
 
         self.assertEquals(len(members1), 3)
         self.assertEquals(len(members2), 3)
@@ -153,7 +155,7 @@ class GoGridLBMockHttp(MockHttpTestCase)
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _api_grid_loadbalancer_add(self, method, url, body, headers):
-        query = urlparse(url).query
+        query = urlparse.urlparse(url).query
         self.assertTrue(query.find('loadbalancer.type=round+robin') != -1)
 
         body = self.fixtures.load('loadbalancer_add.json')

Modified: libcloud/branches/py3k/test/loadbalancer/test_rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/test/loadbalancer/test_rackspace.py?rev=1209949&r1=1209948&r2=1209949&view=diff
==============================================================================
--- libcloud/branches/py3k/test/loadbalancer/test_rackspace.py (original)
+++ libcloud/branches/py3k/test/loadbalancer/test_rackspace.py Sat Dec  3 17:02:06 2011
@@ -13,7 +13,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import httplib
 import sys
 import unittest
 
@@ -22,6 +21,8 @@ try:
 except ImportError:
     import json
 
+from libcloud.py3 import httplib
+
 from libcloud.loadbalancer.base import Member, Algorithm
 from libcloud.loadbalancer.drivers.rackspace import RackspaceLBDriver
 from libcloud.loadbalancer.drivers.rackspace import RackspaceUKLBDriver



Mime
View raw message