Clemens Wolff created LIBCLOUD-993:
--------------------------------------

             Summary: upload_object_via_stream crashes for Azure driver
                 Key: LIBCLOUD-993
                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-993
             Project: Libcloud
          Issue Type: Bug
          Components: Storage
            Reporter: Clemens Wolff


Running the 
[examples|http://libcloud.readthedocs.io/en/latest/storage/examples.html] in 
the documentation for object upload via streams fails when using the Azure Blob 
Storage driver.

Setup:
{code}
python3 -m venv venv
venv/bin/pip install apache-libcloud==2.3.0{code}
Minimal stand-alone code snippet to reproduce:
{code}
import os

from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver

key = ''  # setme
secret = ''  # setme
container_name = 'libcloudtest'
file_path = __file__
object_name = os.path.basename(__file__)

cls = get_driver(Provider.AZURE_BLOBS)
driver = cls(key, secret)

container = driver.create_container(container_name)

with open(file_path, 'rb') as fobj:
    driver.upload_object_via_stream(iterator=fobj,
                                    container=container,
                                    object_name=object_name)
{code}
Stack-trace:
{noformat}
Traceback (most recent call last):
File "./azure_upload.py", line 24, in <module>
driver.upload_object_via_stream(iterator=fobj, container=container, 
object_name=object_name)
File "/c/Repos/libcloud/libcloud/storage/drivers/azure_blobs.py", line 821, in 
upload_object_via_stream
stream=iterator)
File "/c/Repos/libcloud/libcloud/storage/drivers/azure_blobs.py", line 924, in 
_put_object
driver=self)
libcloud.common.types.LibcloudError: <LibcloudError in 
<libcloud.storage.drivers.azure_blobs.AzureBlobsStorageDriver object at 
0x7ff3e2132400> 'Unexpected status code, status_code=403'>{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to