Merge pull request #1310 from coreos-inc/gcsfix
Fix client side chunk paths
This commit is contained in:
commit
d33804c22e
1 changed files with 6 additions and 4 deletions
|
@ -307,9 +307,11 @@ class _CloudStorage(BaseStorageV2):
|
||||||
def _client_side_chunk_join(self, final_path, chunk_list):
|
def _client_side_chunk_join(self, final_path, chunk_list):
|
||||||
# If there's only one chunk, just "move" (copy and delete) the key and call it a day.
|
# If there's only one chunk, just "move" (copy and delete) the key and call it a day.
|
||||||
if len(chunk_list) == 1:
|
if len(chunk_list) == 1:
|
||||||
chunk_path = chunk_list[0].path
|
chunk_path = self._init_path(chunk_list[0].path)
|
||||||
|
abs_final_path = self._init_path(final_path)
|
||||||
|
|
||||||
# Let the copy raise an exception if it fails.
|
# Let the copy raise an exception if it fails.
|
||||||
self._cloud_bucket.copy_key(final_path, self._bucket_name, chunk_path)
|
self._cloud_bucket.copy_key(abs_final_path, self._bucket_name, chunk_path)
|
||||||
|
|
||||||
# Attempt to clean up the old chunk.
|
# Attempt to clean up the old chunk.
|
||||||
try:
|
try:
|
||||||
|
@ -317,7 +319,7 @@ class _CloudStorage(BaseStorageV2):
|
||||||
except IOError:
|
except IOError:
|
||||||
# We failed to delete a chunk. This sucks, but we shouldn't fail the push.
|
# We failed to delete a chunk. This sucks, but we shouldn't fail the push.
|
||||||
msg = 'Failed to clean up chunk %s for move of %s'
|
msg = 'Failed to clean up chunk %s for move of %s'
|
||||||
logger.exception(msg, chunk_path, final_path)
|
logger.exception(msg, chunk_path, abs_final_path)
|
||||||
else:
|
else:
|
||||||
# Concatenate and write all the chunks as one key.
|
# Concatenate and write all the chunks as one key.
|
||||||
concatenated = filelike.FilelikeStreamConcat(self._chunk_generator(chunk_list))
|
concatenated = filelike.FilelikeStreamConcat(self._chunk_generator(chunk_list))
|
||||||
|
@ -326,7 +328,7 @@ class _CloudStorage(BaseStorageV2):
|
||||||
# Attempt to clean up all the chunks.
|
# Attempt to clean up all the chunks.
|
||||||
for chunk in chunk_list:
|
for chunk in chunk_list:
|
||||||
try:
|
try:
|
||||||
self._cloud_bucket.delete_key(chunk.path)
|
self._cloud_bucket.delete_key(self._init_path(chunk.path))
|
||||||
except IOError:
|
except IOError:
|
||||||
# We failed to delete a chunk. This sucks, but we shouldn't fail the push.
|
# We failed to delete a chunk. This sucks, but we shouldn't fail the push.
|
||||||
msg = 'Failed to clean up chunk %s for reupload of %s'
|
msg = 'Failed to clean up chunk %s for reupload of %s'
|
||||||
|
|
Reference in a new issue