You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/04/16 19:56:25 UTC

svn commit: r1468530 - in /libcloud/branches/0.12.x: ./ CHANGES libcloud/storage/drivers/cloudfiles.py libcloud/test/storage/test_cloudfiles.py

Author: tomaz
Date: Tue Apr 16 17:56:25 2013
New Revision: 1468530

URL: http://svn.apache.org/r1468530
Log:
Fix a regression with removed ex_force_service_region constructor kwarg in
the CloudFiles driver.

Part of LIBCLOUD-260.

Modified:
    libcloud/branches/0.12.x/   (props changed)
    libcloud/branches/0.12.x/CHANGES
    libcloud/branches/0.12.x/libcloud/storage/drivers/cloudfiles.py
    libcloud/branches/0.12.x/libcloud/test/storage/test_cloudfiles.py

Propchange: libcloud/branches/0.12.x/
------------------------------------------------------------------------------
  Merged /libcloud/trunk:r1467703-1468525

Modified: libcloud/branches/0.12.x/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/CHANGES?rev=1468530&r1=1468529&r2=1468530&view=diff
==============================================================================
--- libcloud/branches/0.12.x/CHANGES (original)
+++ libcloud/branches/0.12.x/CHANGES Tue Apr 16 17:56:25 2013
@@ -26,6 +26,11 @@ Changes with Apache Libcloud in developm
       (LIBCLOUD-314)
       [Trevor Powell]
 
+ *) Storage
+
+    - Fix a regression with removed ex_force_service_region constructor kwarg in
+      the CloudFiles driver. (LIBCLOUD-260)
+
 Changes with Apache Libcloud 0.12.3:
 
   *) General

Modified: libcloud/branches/0.12.x/libcloud/storage/drivers/cloudfiles.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/storage/drivers/cloudfiles.py?rev=1468530&r1=1468529&r2=1468530&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/storage/drivers/cloudfiles.py (original)
+++ libcloud/branches/0.12.x/libcloud/storage/drivers/cloudfiles.py Tue Apr 16 17:56:25 2013
@@ -113,6 +113,9 @@ class CloudFilesConnection(OpenStackBase
         self.accept_format = 'application/json'
         self.cdn_request = False
 
+        if self._ex_force_service_region:
+            self.service_region = self._ex_force_service_region
+
     def get_endpoint(self):
         # First, we parse out both files and cdn endpoints
         # for each auth version
@@ -131,6 +134,13 @@ class CloudFilesConnection(OpenStackBase
         if self.cdn_request:
             eps = cdn_eps
 
+        if self.service_region:
+            _eps = []
+            for ep in eps:
+                if ep['region'].lower() == self.service_region.lower():
+                    _eps.append(ep)
+            eps = _eps
+
         if len(eps) == 0:
             raise LibcloudError('Could not find specified endpoint')
 

Modified: libcloud/branches/0.12.x/libcloud/test/storage/test_cloudfiles.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/test/storage/test_cloudfiles.py?rev=1468530&r1=1468529&r2=1468530&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/test/storage/test_cloudfiles.py (original)
+++ libcloud/branches/0.12.x/libcloud/test/storage/test_cloudfiles.py Tue Apr 16 17:56:25 2013
@@ -82,6 +82,23 @@ class CloudFilesTests(unittest.TestCase)
         self.assertEquals('/v1/MossoCloudFS',
             driver.connection.request_path)
 
+    def test_invalid_ex_force_service_region(self):
+        driver = CloudFilesStorageDriver('driver', 'dummy',
+                ex_force_service_region='invalid')
+
+        try:
+            driver.list_containers()
+        except:
+            e = sys.exc_info()[1]
+            self.assertEquals(e.value, 'Could not find specified endpoint')
+        else:
+            self.fail('Exception was not thrown')
+
+    def test_ex_force_service_region(self):
+        driver = CloudFilesStorageDriver('driver', 'dummy',
+                ex_force_service_region='ORD')
+        driver.list_containers()
+
     def test_force_auth_url_kwargs(self):
         kwargs = {
             'ex_force_auth_version': '2.0',