Commit be75629c authored by aiolos's avatar aiolos Committed by Commit bot

Upload to the hash location instead of the file_name on record_wpr upload.

BUG=

Review URL: https://codereview.chromium.org/1067583004

Cr-Commit-Position: refs/heads/master@{#326982}
parent 0ca264b8
...@@ -127,8 +127,9 @@ class WprArchiveInfo(object): ...@@ -127,8 +127,9 @@ class WprArchiveInfo(object):
shutil.move(self.temp_target_wpr_file_path, target_wpr_file_path) shutil.move(self.temp_target_wpr_file_path, target_wpr_file_path)
# Update the hash file. # Update the hash file.
target_wpr_file_hash = cloud_storage.CalculateHash(target_wpr_file_path)
with open(target_wpr_file_path + '.sha1', 'wb') as f: with open(target_wpr_file_path + '.sha1', 'wb') as f:
f.write(cloud_storage.CalculateHash(target_wpr_file_path)) f.write(target_wpr_file_hash)
f.flush() f.flush()
self._WriteToFile() self._WriteToFile()
...@@ -141,7 +142,7 @@ class WprArchiveInfo(object): ...@@ -141,7 +142,7 @@ class WprArchiveInfo(object):
'user stories to cloud storage.') 'user stories to cloud storage.')
return return
try: try:
cloud_storage.Insert(self._bucket, target_wpr_file, cloud_storage.Insert(self._bucket, target_wpr_file_hash,
target_wpr_file_path) target_wpr_file_path)
except cloud_storage.CloudStorageError, e: except cloud_storage.CloudStorageError, e:
logging.warning('Failed to upload wpr file %s to cloud storage. ' logging.warning('Failed to upload wpr file %s to cloud storage. '
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment