Skip to content

Commit

Permalink
Reworded the metadata-directive docs
Browse files Browse the repository at this point in the history
Also touched up code from pr-check script
  • Loading branch information
kyleknap committed Mar 5, 2015
1 parent b88c3b4 commit dca7a7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions awscli/customizations/s3/subcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,20 @@
'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'
' specified by the CLI command. Note that if you are '
'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.')
}


Expand Down
3 changes: 3 additions & 0 deletions tests/integration/customizations/s3/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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():
Expand All @@ -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')
Expand Down

0 comments on commit dca7a7c

Please sign in to comment.