GitHub user daviskirk opened a pull request:
https://github.com/apache/libcloud/pull/1202
Fix hash value in azure blob store
## Upgrade azure blob storage api
### Description
* Upgrade to minimum api version allowed by azure (see )
* Return actual file (md5) hash instead of etag ('"0xFFFFFFFFFFFFFFF"')
The current trunk version of libcloud throws a Libcloud error also
described in (https://issues.apache.org/jira/browse/LIBCLOUD-851)
```
Traceback (most recent call last):
File "...", line 12, in <module>
c = d.list_containers()[1]
File "libcloud/libcloud/storage/base.py", line 209, in list_containers
return list(self.iterate_containers())
File "libcloud/libcloud/storage/drivers/azure_blobs.py", line 371, in
iterate_containers
(response.status), driver=self)
libcloud.common.types.LibcloudError: <LibcloudError in
<libcloud.storage.drivers.azure_blobs.AzureBlobsStorageDriver object at
0x7f7389bf1080> 'Unexpected status code: 400'>
```
and the corresponing response body of the failing request is:
```
response.body
'<?xml version="1.0"
encoding="utf-8"?><Error><Code>InvalidHeaderValue</Code><Message>The value for
one of the HTTP headers is not in the correct
format.\nRequestId:dd262993-501e-0030-6cd1-d58682000000\nTime:2018-04-16T22:24:39.6566784Z</Message><HeaderName>x-ms-version</HeaderName><HeaderValue>2012-02-12</HeaderValue></Error>'
```
From looking at:
https://docs.microsoft.com/en-us/rest/api/storageservices/versioning-for-the-azure-storage-services#for-blob-storage-accounts
the easiest fix is to upgrade the api version to the minumum supported
version (2014-02-12).
In addition, the other cloud drivers all provide the actual md5 hash when
uploading or getting an object. This allows the user to check if a file has
changed online compared to locally. The current master version provides the
etag value as the "hash" attribute (interestingly with literal quotes around
the tag: `'"0xFFFFFFFFFFFFFFF"'`) which is not compatible with the other
drivers.
Replace this with the PR description (mention the changes you have made, why
you have made them, provide some background and any references to the
provider
documentation if needed, etc.).
I am assuming that these are both bugs and not design decisions (if so feel
free to close this request).
### Status
- work in progress
### Checklist (tick everything that applies)
- [ ] [Code
linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide)
(required, can be done after the PR checks)
- [ ] Documentation
- [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
- [ ]
[ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes)
(required for bigger changes)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/daviskirk/libcloud
851_fix-azure-blob-storage-api-version
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/libcloud/pull/1202.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1202
----
commit c73beb6879353ff9689f23580a5ee3499782de05
Author: Davis Kirkendall <davis.e.kirkendall@...>
Date: 2018-04-16T22:05:02Z
Fix hash value in azure blob store
- Upgrade to minimum api version allowed by azure (see
https://docs.microsoft.com/en-us/rest/api/storageservices/versioning-for-the-azure-storage-services#for-blob-storage-accounts)
- Return actual file (md5) hash instead of etag ('"0xFFFFFFFFFFFFFFF"')
----
---