Antoine R. Dumont created LIBCLOUD-851:
------------------------------------------
Summary: Azure blob storage - Unable to list blobs of a container
Key: LIBCLOUD-851
URL: https://issues.apache.org/jira/browse/LIBCLOUD-851
Project: Libcloud
Issue Type: Bug
Components: Storage
Environment: Debian GNU/Linux
Reporter: Antoine R. Dumont
Hello,
Trying to list the blobs of a container in an azure blob storage, the
instanciation step of a container systematically breaks with a 400 bad request.
I have not enough details in the error message:
```
Traceback (most recent call last):
File "./bin/basic-scenario", line 20, in <module>
container = driver.get_container(container_name=container_name)
File
"/usr/lib/python3/dist-packages/libcloud/storage/drivers/azure_blobs.py", line
441, in get_container
(response.status), driver=self)
libcloud.common.types.LibcloudError: <LibcloudError in
<libcloud.storage.drivers.azure_blobs.AzureBlobsStorageDriver object at
0x7f674c6b67f0> 'Unexpected status code: 400'
```
Here is the code of ./bin/basic-scenario:
```
#!/usr/bin/env python3
from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver
if __name__ == '__main__':
# setup
account_name = 'account-name'
key = 'secret-key'
container_name = 'container-name'
# libcloud setup
cls = get_driver(Provider.AZURE_BLOBS)
# this instanciates ok
driver = cls(key=account_name, secret=key)
# this explodes
container = driver.get_container(container_name=container_name)
for c in driver.iterate_container_objects(container):
print(c)
```
Trying to dig in the error, using LIBCLOUD_DEBUG:
```
LIBCLOUD_DEBUG=error-output ./bin/basic-scenario
```
I have some more input, here is the content of error-output file:
```
# -------- begin 140359483662744 request ----------
curl -i --head -H 'Authorization: SharedKey account-name:blabla/blabla/blabla='
-H 'x-ms-version: 2012-02-12' -H 'User-Agent: libcloud/0.20.0 (Microsoft Azure
(blobs)) ' -H 'Accept-Encoding: gzip,deflate' -H 'x-ms-date: Fri, 09 Sep 2016
10:19:36 GMT' -H 'X-LC-Request-ID: 140340383662744' --compress
'https://account-name.blob.core.windows.net:443/container-name?restype=container'
# -------- begin 140359483662744:140359483745056 response ----------
HTTP/1.1 400 The value for one of the HTTP headers is not in the correct format.
Transfer-Encoding: chunked
Server: Microsoft-HTTPAPI/2.0
X-Ms-Request-Id: ad3456f8-0002-0076-2f83-0ab6c2888888
Date: Fri, 09 Sep 2016 10:19:36 GMT
0
0
# -------- end 140359483662744:140359483745056 response ----------
```
As my package is a debian one with what seems an old version (0.20.0, seen in
CHANGES.rst and not in jira), I tried with the current git repository (1.1.0).
Procedure:
1. purged python3-libcloud
2. `python3 setup.py install` from git repository.
I have a similar output:
```
# -------- begin 139921458559016 request ----------
curl -i --head -H 'x-ms-version: 2012-02-12' -H 'Authorization: SharedKey
account-name:blabloblu=' -H 'X-LC-Request-ID: 139921458559432' -H 'User-Agent:
libcloud/1.1.0 (Microsoft Azure (blobs)) ' -H 'Accept-Encoding: gzip,deflate'
-H 'x-ms-date: Fri, 09 Sep 2016 10:51:53 GMT' --compress
'https://account-name.blob.core.windows.net:443/container-name?restype=container'
# -------- begin 139921458559016:139921458672360 response ----------
HTTP/1.1 400 The value for one of the HTTP headers is not in the correct format.
Transfer-Encoding: chunked
Server: Microsoft-HTTPAPI/2.0
X-Ms-Request-Id: 10947125-0001-005e-7788-0ac27a888888
Date: Fri, 09 Sep 2016 10:51:52 GMT
0
0
# -------- end 139921458559016:139921458672360 response ----------
```
I'm stuck there since i don't see anything wrong with the headers.
Do you please have some hint?
Thanks for your time
Note:
- I'm confident in the azure blob storage setup and credentials since i got it
working with another library (azure-storage via pip3)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)