Uploaded image for project: 'Libcloud'
  1. Libcloud
  2. LIBCLOUD-1037

Azure Storage driver crashes when used with Azurite

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      There's a popular emulator for Azure Storage called Azurite. I tried to configure libcloud to talk to Azurite like so:

      ```
      from libcloud.storage.types import Provider
      from libcloud.storage.providers import get_driver
      # the secret and account name are defined in the azurite documentation
      key = 'devstoreaccount1'
      secret = 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=='

      # run azurite via `docker run -e executable=blob -d -t -p 10000:10000 -v arafato/azurite`
      host = 'localhost:10000'

      AzureBlobs = get_driver(Provider.AZURE_BLOBS)
      driver = AzureBlobs(key, secret, host=host, secure=False)
      driver.create_container('somecontainer')
      ```

      Running this script crashes: Python stacktrace, Azurite stacktrace.

      The root cause is that the AzureBlobsStorageDriver currently assumes that the storage accounts are always going to be identified via the hostname (e.g. someaccount.blob.core.windows.net) but Azurite expects the accounts to be identified via a path prefix (e.g. /someaccount).

      Fixing this will require a change in the driver to add a prefix to all action URLs if a custom host is set. I believe it's valuable to make this change since it would enable the Azure Blobs driver in libcloud to be used more easily for automated integration testing where developers don't necessarily want to talk to a live Azure Storage account. I have a sample patch for this issue at CatalystCode/libcloud@1037_fix-azurite.

      I suspect that also the new Blob Storage on IoT edge will see the same kinds of errors since it also identifies accounts by URL prefix instead of hostname.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                c-w Clemens Wolff
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 40m
                  3h 40m