cloud: gcp: decode base64 when comparing files

Otherwise comparison with string fails on Python3, as base64 returns bytes.

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2017-11-02 01:10:13 +02:00
parent 8fac23f93d
commit 7e90522d3f
+2 -2
View File
@@ -694,7 +694,8 @@ class DataCloudGCP(DataCloudBase):
"""
Verify local and remote checksums.
"""
b64_encoded_md5 = base64.b64encode(file_md5(fname)[1])
md5 = file_md5(fname)[1]
b64_encoded_md5 = base64.b64encode(md5).decode() if md5 else None
if blob.md5_hash == b64_encoded_md5:
return True
@@ -726,7 +727,6 @@ class DataCloudGCP(DataCloudBase):
try:
blob.download_to_filename(tmp_file)
data_item.import_cache(tmp_file)
except Exception as exc:
Logger.error('Failed to download "{}": {}'.format(key, exc))
return None