libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [libcloud] michaelperel commented on a change in pull request #1278: [LIBCLOUD-1037] Add Azurite support for Azure Blob Storage driver
Date Tue, 28 May 2019 23:32:35 GMT
michaelperel commented on a change in pull request #1278: [LIBCLOUD-1037] Add Azurite support
for Azure Blob Storage driver
URL: https://github.com/apache/libcloud/pull/1278#discussion_r288336908
 
 

 ##########
 File path: libcloud/storage/drivers/azure_blobs.py
 ##########
 @@ -156,6 +156,27 @@ class AzureBlobsConnection(AzureConnection):
     """
     Represents a single connection to Azure Blobs
     """
+    def __init__(self, *args, **kwargs):
+        self.account_prefix = kwargs.pop('account_prefix', None)
+        super(AzureBlobsConnection, self).__init__(*args, **kwargs)
+
+    def morph_action_hook(self, action):
+        action = super(AzureBlobsConnection, self).morph_action_hook(action)
+
+        # The main Azure Blob Storage service uses the hostname to distinguish
+        # between accounts, e.g. `theaccount.blob.core.windows.net`.
+        # However, some custom deployments of the service such as the official
+        # emulator (https://github.com/Azure/Azurite) instead use a URL prefix
+        # such as `/theaccount`. The use-case is drivers instantiated via
+        # `host=somewhere.tld` and `key='theaccount'`.
+        # If a user wants to specify a custom host without an account prefix,
+        # e.g. for use-cases where the custom host implements an auditing
+        # proxy or similar, they can instantiate the driver with
+        # `host=theaccount.somewhere.tld` and `key=''`.
+        if self.account_prefix:
 
 Review comment:
   consider "is not None", as [per the contributing guide](https://libcloud.readthedocs.io/en/latest/development.html#prefer-to-use-is-not-none-when-checking-if-a-variable-is-provided-or-defined)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message