libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [2/3] git commit: Fix OpenStack Swift driver so it works correctly.
Date Wed, 21 May 2014 13:14:41 GMT
Fix OpenStack Swift driver so it works correctly.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/be258dc9
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/be258dc9
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/be258dc9

Branch: refs/heads/trunk
Commit: be258dc9d8100697f27078639dc24b4f256d436d
Parents: 7c96748
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Wed May 21 14:07:41 2014 +0200
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Wed May 21 14:07:41 2014 +0200

----------------------------------------------------------------------
 libcloud/storage/drivers/cloudfiles.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/be258dc9/libcloud/storage/drivers/cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py
index 52b999f..6591c7d 100644
--- a/libcloud/storage/drivers/cloudfiles.py
+++ b/libcloud/storage/drivers/cloudfiles.py
@@ -186,11 +186,17 @@ class OpenStackSwiftConnection(CloudFilesConnection):
     Connection class for the OpenStack Swift endpoint.
     """
 
+    # TODO: Reverse the relationship - Swift -> CloudFiles
+
     def __init__(self, *args, **kwargs):
         super(OpenStackSwiftConnection, self).__init__(*args, **kwargs)
         self._service_type = self._ex_force_service_type or 'object-store'
         self._service_name = self._ex_force_service_name or 'swift'
-        self._service_region = self._ex_force_service_region.upper()
+
+        if self._ex_force_service_region:
+            self._service_region = self._ex_force_service_region.upper()
+        else:
+            self._service_region = None
 
     def get_endpoint(self, *args, **kwargs):
         if '2.0' in self._auth_version:
@@ -200,10 +206,10 @@ class OpenStackSwiftConnection(CloudFilesConnection):
                 region=self._service_region)
         elif ('1.1' in self._auth_version) or ('1.0' in self._auth_version):
             endpoint = self.service_catalog.get_endpoint(
-                name=self._service_name, region=self._region_name)
+                name=self._service_name, region=self._service_region)
 
-        if self.endpoint_url in endpoint:
-            return endpoint[self.endpoint_url]
+        if PUBLIC_ENDPOINT_KEY in endpoint:
+            return endpoint[PUBLIC_ENDPOINT_KEY]
         else:
             raise LibcloudError('Could not find specified endpoint')
 


Mime
View raw message