From dca7a7c862285481536199f93d86539c12fc30f7 Mon Sep 17 00:00:00 2001 From: kyleknap Date: Wed, 4 Mar 2015 16:36:11 -0800 Subject: [PATCH] Reworded the metadata-directive docs Also touched up code from pr-check script --- awscli/customizations/s3/subcommands.py | 9 +++++++-- tests/integration/customizations/s3/test_plugin.py | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/awscli/customizations/s3/subcommands.py b/awscli/customizations/s3/subcommands.py index 093e95ae9a69..fce5dbc0acdc 100644 --- a/awscli/customizations/s3/subcommands.py +++ b/awscli/customizations/s3/subcommands.py @@ -218,6 +218,10 @@ 'help_text': ( 'Specifies whether the metadata is copied from the source object ' 'or replaced with metadata provided when copying S3 objects. ' + 'Note that if the object is copied over in parts, the source ' + 'object\'s metadata will not be copied over, no matter the value for ' + '``--metadata-directive``, and instead the desired metadata values ' + 'must be specified as parameters on the command line. ' 'Valid values are ``COPY`` and ``REPLACE``. If this parameter is not ' 'specified, ``COPY`` will be used by default. If ``REPLACE`` is used, ' 'the copied object will only have the metadata values that were' @@ -225,8 +229,9 @@ 'using any of the following parameters: ``--content-type``, ' '``content-language``, ``--content-encoding``, ' '``--content-disposition``, ``-cache-control``, or ``--expires``, you ' - 'will need to specify ``--metadata-directive REPLACE`` if you want ' - 'the copied object to have the specified metadata value.') + 'will need to specify ``--metadata-directive REPLACE`` for ' + 'non-multipart copies if you want the copied objects to have the ' + 'specified metadata values.') } diff --git a/tests/integration/customizations/s3/test_plugin.py b/tests/integration/customizations/s3/test_plugin.py index 31204915bf94..f0e1650abac9 100644 --- a/tests/integration/customizations/s3/test_plugin.py +++ b/tests/integration/customizations/s3/test_plugin.py @@ -544,6 +544,7 @@ def test_copy_metadata_directive(self): extra_args=metadata) p = aws('s3 cp s3://%s/%s s3://%s/%s' % (bucket_name, original_key, bucket_name, new_key)) + self.assert_no_errors(p) response = self.head_object(bucket_name, new_key) # These values should have the metadata of the source object metadata_ref = copy.copy(metadata) @@ -554,6 +555,7 @@ def test_copy_metadata_directive(self): # Use REPLACE to wipe out all of the metadata. p = aws('s3 cp s3://%s/%s s3://%s/%s --metadata-directive REPLACE' % (bucket_name, original_key, bucket_name, new_key)) + self.assert_no_errors(p) response = self.head_object(bucket_name, new_key) # Make sure all of the original metadata is gone. for name, value in metadata_ref.items(): @@ -564,6 +566,7 @@ def test_copy_metadata_directive(self): p = aws('s3 cp s3://%s/%s s3://%s/%s --metadata-directive REPLACE ' '--content-type bar' % (bucket_name, original_key, bucket_name, new_key)) + self.assert_no_errors(p) response = self.head_object(bucket_name, new_key) # Make sure the content type metadata is included self.assertEqual(response['ContentType'], 'bar')