-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Ignore paramfile for s3 --website-redirect #1137
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You | ||
# may not use this file except in compliance with the License. A copy of | ||
# the License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0/ | ||
# | ||
# or in the "license" file accompanying this file. This file is | ||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF | ||
# ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
from awscli.testutils import BaseAWSCommandParamsTest, FileCreator | ||
import re | ||
|
||
import mock | ||
from awscli.compat import six | ||
|
||
|
||
class TestSyncCommand(BaseAWSCommandParamsTest): | ||
|
||
prefix = 's3 sync ' | ||
|
||
def setUp(self): | ||
super(TestSyncCommand, self).setUp() | ||
self.files = FileCreator() | ||
|
||
def tearDown(self): | ||
super(TestSyncCommand, self).tearDown() | ||
self.files.remove_all() | ||
|
||
def test_website_redirect_ignore_paramfile(self): | ||
full_path = self.files.create_file('foo.txt', 'mycontent') | ||
cmdline = '%s %s s3://bucket/key.txt --website-redirect %s' % \ | ||
(self.prefix, self.files.rootdir, 'http://someserver') | ||
self.parsed_responses = [ | ||
{"CommonPrefixes": [], "Contents": []}, | ||
{'ETag': '"c8afdb36c52cf4727836669019e69222"'} | ||
] | ||
self.run_cmd(cmdline, expected_rc=0) | ||
|
||
# The only operations we should have called are ListObjects/PutObject. | ||
self.assertEqual(len(self.operations_called), 2, self.operations_called) | ||
self.assertEqual(self.operations_called[0][0].name, 'ListObjects') | ||
self.assertEqual(self.operations_called[1][0].name, 'PutObject') | ||
# Make sure that the specified web address is used as opposed to the | ||
# contents of the web address when uploading the object | ||
self.assertEqual( | ||
self.operations_called[1][1]['website_redirect_location'], | ||
'http://someserver' | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
On a side note, I do not like that all custom commands have
custom
as its service in the event that is emitted. It is not good if there are ever custom commands that overlap in the cli namespace even though they may have a different command lineage.However, I do not think any change can be made till after the command lineage PR is merged.
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.
Yeah, let's get the command lineage PR merged so we can update this PR to avoid
custom
.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.
Cool. This change may be a little larger than expected (a change in the clidriver and custom commands). If you look further down in the list of black listed arguments, the
s3api
commands that use--website-redirect
have the event listed ass3
...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.
Correction: the change for the data driven commands need to come in
arguments.py
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.
Sorry for all the spamming. Actually a change will need to take place at
unpack_argument
inargprocess.py
: https://github.com/aws/aws-cli/blob/develop/awscli/argprocess.py#L63The reason being that the service_name/operation_name input limits all commands to the strict two command length structure.
For example, for the custom top layer
s3
command, acustom
had to be added to fit the input because bothservice_name
andoperation_name
are required. This is an issue because if I wanted to apply a handler to the eventcustom.s3.*.some-argument
I would not be able to register to all ofs3
's operation commands becauses3
's operation commands must emits3.operation.some-argument
orcustom.operation.some-argument
to fit the inputs to that function.This is also an issue for commands that have more than two commands like waiters.
I propose to leave the PR as is and make this change in a subsequent PR because it is outside the scope of the current bug fix as I will have to change the clidriver and some handlers as well.
@jamesls Let me know what you think.
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.
My preference is to just put in the long term fix rather than a temporary fix that will be removed once the changes are plumbed through clidriver/handlers.
However, I'm ok with putting this fix in for the time being. Code and test themselves look good. Feel free to merge if you want.
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.
I added a reminder to fix it in my latest commit.