-
Notifications
You must be signed in to change notification settings - Fork 4.4k
[v2] Perform copy with no overwrite using IfNoneMatch #9910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v2] Perform copy with no overwrite using IfNoneMatch #9910
Conversation
6183e9e to
a61aa8e
Compare
This commit rolls back changes made to force multipart copies if no overwrite is specified. This includes checking for 0-length files. It also removes the CopyObject argument block list, since IfNoneMatch is now allowed and was the only argument in the list.
Removes the tests for 0 length files and moves some tests to the TestNonMultipartCopy class, since CopyObject accepts IfNoneMatch and no longer needs to force multipart copying.
Update the tests to account for different operations being called, since multipart upload is now not necessary.
a61aa8e to
5dce4bc
Compare
The IfNoneMatch header is set on the CopyObject request
awscli/s3transfer/copies.py
Outdated
| 'IfNoneMatch', | ||
| ] | ||
|
|
||
| COPY_OBJECT_ARGS_BLOCKLIST = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we delete the whole property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, and then I should also roll back changes to this test:
| if arg not in CopySubmissionTask.COPY_OBJECT_ARGS_BLOCKLIST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 529124d
awscli/s3transfer/copies.py
Outdated
| # If it is less than threshold and ifNoneMatch is not in parameters | ||
| # do a regular copy else do multipart copy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comment to reflect code change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1652763
Removes the constant and updates the test using it.
Replace with the previously existing comment since the IfNoneMatch header is no longer used for the copy operation logic.
s3transfer does not have a 'no overwrite' flag, which is specific to the CLI.
aemous
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 small nits
The test was doing an upload instead of a (bucket-to-bucket) copy. Fixed the test expected responses to match what should be called.
aemous
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issue #, if available:
Description of changes:
s3-no-overwritebranch withv2.This PR is merging to the
s3-no-overwritefeature branch.Now that AWS S3 supports the
IfNoneMatchheader onCopyObjectoperations, we no longer need the more complicated solution that forces multipart upload copies for all copy and move operations. Additionally, we don't need to have a special case for 0-byte object. This PR rolls back some of the changes already added and goes back to allowingIfNoneMatchheader to go toCopyObjectoperations.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.