Skip to content

Commit

Permalink
Merge pull request #938 from kyleknap/multipart-mv
Browse files Browse the repository at this point in the history
Delete large files for cross region ``mv``
  • Loading branch information
kyleknap committed Oct 8, 2014
2 parents ccd607c + b485c05 commit 0c0ac39
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
CHANGELOG
=========

Next Release (TBD)
==================

* bugfix:``aws s3 mv``: Delete multi-part objects when transferring objects
across regions using ``--source-region``
(`issue 938 <https://github.com/aws/aws-cli/pull/938>`__)


1.5.1
=====

Expand Down
2 changes: 1 addition & 1 deletion awscli/customizations/s3/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def __call__(self):
LOGGER.debug("Waiting for download to finish.")
self._context.wait_for_completion()
bucket, key = find_bucket_key(self._filename.src)
params = {'endpoint': self._filename.endpoint,
params = {'endpoint': self._filename.source_endpoint,
'bucket': bucket, 'key': key}
response_data, http = operate(
self._filename.service, 'DeleteObject', params)
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/customizations/s3/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,23 @@ def testMvRegion(self):
self.assertFalse(
self.key_exists(bucket_name=self.src_bucket, key_name='foo.txt'))

def testMvLargeFileRegion(self):
foo_txt = self.files.create_file('foo.txt', 'a' * 1024 * 1024 * 10)
p = aws('s3 cp %s s3://%s/foo.txt --region %s' %
(foo_txt, self.src_bucket, self.src_region))
self.assert_no_errors(p)

p2 = aws(
's3 mv s3://%s/foo.txt s3://%s/ --region %s --source-region %s ' %
(self.src_bucket, self.dest_bucket, self.dest_region,
self.src_region)
)
self.assert_no_errors(p2)
self.assertTrue(
self.key_exists(bucket_name=self.dest_bucket, key_name='foo.txt'))
self.assertFalse(
self.key_exists(bucket_name=self.src_bucket, key_name='foo.txt'))


class TestWarnings(BaseS3CLICommand):
def extra_setup(self):
Expand Down

0 comments on commit 0c0ac39

Please sign in to comment.