-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Added a --source-region
parameter.
#872
Conversation
This parameter ensures the ability to do trans-region syncs, moves, and copies. Tests were expanded as well to better test handling endpoints.
This is a feature addition for Tests were improved in two ways. |
Can you clarify why the FileGenerator now needs both an endpoint and source_endpoint? I was expecting that for sync, one file generator gets the source_endpoint, and the other generator gets the destination endpoint, but the FileGenerator itself only needs a single I realize that this may be a slightly larger refactoring to do this, but I think it makes the most sense going forward. |
FileGenerator for |
Also, this scenario is not limited to |
What I was alluding to was that the I think I might have underestimated the work by calling this a "slightly larger refactoring". Looking into this, it's actually quite a bit of work to decouple fileinfo from filegenerator. However, long term, I think this is the right direction. |
This refactoring removes the necessity of passing arguments through the ``FileGenerator`` class in order for the ``FileInfo`` class to obtain the arguments it requires to perform an operation.
I agree it was about time to break it up. So here is how I refactored the code. There are two new classes. A |
Changes Unknown when pulling c931e54 on kyleknap:source-region into * on aws:develop*. |
LGTM, but I'll defer to James for the final review. |
@@ -579,6 +594,74 @@ def test_sync_with_delete_option_with_same_prefix(self): | |||
self.assertEqual('', p.stdout) | |||
|
|||
|
|||
class TestSourceRegion(BaseS3CLICommand): | |||
def extra_setup(self): | |||
name_comp = [] |
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.
Is this used anywhere?
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, misread, ignore above comment. Is there any reason you couldn't use the randomly generated names?
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.
According to the issue, this redirect error happens every time when there is a dot in the name or the bucket name is not DNS compatible. So, I decided to make random url names to satisfy the conditions. When I tested it, the error does not occur if the bucket name does not have those properties. The error does happen with the names I generate as shown in the testFailWithoutRegion
test
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.
Oh that's right, makes perfect sense. Would you mind adding a comment somewhere about the fact that we're specifically testing non DNS compatible bucket names?
Overall I think this looks good. I think the refactoring to reduce the coupling between the file generator and the actual S3 operations is great. I just have two small things:
|
Sounds good. How about for |
Changes Unknown when pulling b4c932d on kyleknap:source-region into * on aws:develop*. |
@@ -150,7 +172,7 @@ class TestMoveCommand(BaseS3CLICommand): | |||
def test_mv_local_to_s3(self): | |||
bucket_name = self.create_bucket() | |||
full_path = self.files.create_file('foo.txt', 'this is foo.txt') | |||
p = aws('s3 mv %s s3://%s/foo.txt' % (full_path, | |||
p = _aws('s3 mv %s s3://%s/foo.txt' % (full_path, |
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.
These small changes make it hard to review what's actually functionally changed. Another way to accomplish the same thing is to import aws
as _aws
, and then define def aws
in this module that calls to _aws
.
looks good. Just a few small changes, but feel free to merge once feedback's been incorporated. |
Also moved the ``test_plugin.py`` tests out of ``us-east-1`` and into ``us-west-2``.
Added a ``--source-region`` parameter.
This parameter ensures the ability to do
trans-region syncs, moves, and copies. Tests
were expanded as well to better test
handling endpoints.