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/09/15 22:56:34 UTC

[1/2] git commit: LIBCLOUD-399: avoid mutating AzureBlobsConnection at driver instance time

Updated Branches:
  refs/heads/trunk 163f9811d -> 8f815ab6f


LIBCLOUD-399: avoid mutating AzureBlobsConnection at driver instance time

Signed-off-by: Tomaz Muraus <to...@apache.org>


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

Branch: refs/heads/trunk
Commit: 79444117414be2aba91bd8c44d7abc9bd66dc37d
Parents: 163f981
Author: Olivier Grisel <ol...@ensta.org>
Authored: Sun Sep 15 18:11:57 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Sep 15 22:49:06 2013 +0200

----------------------------------------------------------------------
 libcloud/storage/drivers/azure_blobs.py   | 11 +++++++----
 libcloud/test/storage/test_azure_blobs.py | 11 +++++++++++
 2 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/79444117/libcloud/storage/drivers/azure_blobs.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/azure_blobs.py b/libcloud/storage/drivers/azure_blobs.py
index 06e4511..69c9b50 100644
--- a/libcloud/storage/drivers/azure_blobs.py
+++ b/libcloud/storage/drivers/azure_blobs.py
@@ -75,6 +75,8 @@ AZURE_PAGE_CHUNK_SIZE = 512
 # released using the lease_id (which is not exposed to the user)
 AZURE_LEASE_PERIOD = 60
 
+AZURE_STORAGE_HOST_SUFFIX = 'blob.core.windows.net'
+
 
 class AzureBlobLease(object):
     """
@@ -162,7 +164,6 @@ class AzureBlobsConnection(AzureConnection):
     """
     Represents a single connection to Azure Blobs
     """
-    host = 'blob.core.windows.net'
 
 
 class AzureBlobsStorageDriver(StorageDriver):
@@ -176,9 +177,6 @@ class AzureBlobsStorageDriver(StorageDriver):
     def __init__(self, key, secret=None, secure=True, host=None, port=None,
                  **kwargs):
 
-        # The hostname must be 'account.blobs.core.windows.net'
-        self.connectionCls.host = '%s.%s' % (key, self.connectionCls.host)
-
         # B64decode() this key and keep it, so that we don't have to do
         # so for every request. Minor performance improvement
         secret = base64.b64decode(b(secret))
@@ -188,6 +186,11 @@ class AzureBlobsStorageDriver(StorageDriver):
                                         secure=secure, host=host,
                                         port=port, **kwargs)
 
+    def _ex_connection_class_kwargs(self):
+        return {
+            'host': '%s.%s' % (self.key, AZURE_STORAGE_HOST_SUFFIX),
+        }
+
     def _xml_to_container(self, node):
         """
         Converts a container XML node to a container instance

http://git-wip-us.apache.org/repos/asf/libcloud/blob/79444117/libcloud/test/storage/test_azure_blobs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_azure_blobs.py b/libcloud/test/storage/test_azure_blobs.py
index 3255d9d..faf2d19 100644
--- a/libcloud/test/storage/test_azure_blobs.py
+++ b/libcloud/test/storage/test_azure_blobs.py
@@ -934,5 +934,16 @@ class AzureBlobsTests(unittest.TestCase):
         result = self.driver.delete_object(obj=obj)
         self.assertTrue(result)
 
+    def test_storage_driver_host(self):
+        # Non regression tests for issue LIBCLOUD-399 dealing with the bad
+        # management of the connectionCls.host class attribute
+        driver1 = self.driver_type('fakeaccount1', 'deadbeafcafebabe==')
+        driver2 = self.driver_type('fakeaccount2', 'deadbeafcafebabe==')
+        host1 = driver1.connection.host
+        host2 = driver2.connection.host
+        self.assertEquals(host1, 'fakeaccount1.blob.core.windows.net')
+        self.assertEquals(host2, 'fakeaccount2.blob.core.windows.net')
+
+
 if __name__ == '__main__':
     sys.exit(unittest.main())


[2/2] git commit: Update changes.

Posted by to...@apache.org.
Update changes.


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

Branch: refs/heads/trunk
Commit: 8f815ab6f27da406f8cb82944db8ee20aac7ac9d
Parents: 7944411
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Sep 15 22:51:25 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Sep 15 22:51:25 2013 +0200

----------------------------------------------------------------------
 CHANGES | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/8f815ab6/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index b383f21..37d202c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -97,6 +97,11 @@ Changes with Apache Libcloud in development
       driver. (LIBCLOUD-373)
       [Stefan Friesel]
 
+    - Fix an issue with mutating connectionCls.host attribute in the Azure
+      driver. This bug prevented user from having multiple Azure drivers with
+      different keys instantiated at the same time. (IBCLOUD-399)
+      [Olivier Grisel]
+
   *) Load Balancer
 
    - Expose CloudStack driver directly through the Provider.CLOUDSTACK