Skip to content
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

Explicitly translate supported confi values to TransferConfig #2146

Merged
merged 1 commit into from
Sep 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Explicitly translate supported config values to TransferConfig
The previous implementation made the open-ended assumption that
runtime config translates 1-1 to transfer configs.
This also had the (unintended) side effect that everything in
transfer config was implicitly supported in the ~/.aws/config
file because the config is passed directly to `TransferConfig`.

I've updated the code to have a fixed list of supported config values.
This means that we need to explicitly update this list as we decide
to support for transfer config options.
  • Loading branch information
jamesls committed Sep 1, 2016
commit 777b0aa960745bf7ce09a101a1b59d2aa84c06e5
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-s3-56735.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"category": "``s3``",
"type": "bugfix",
"description": "Fix issue where setting ``addressing_style`` and ``use_accelerate_endpoint`` in your config file would cause ``aws s3`` commands using S3 streams to fail (`#2146 <https://github.com/aws/aws-cli/issues/2146>`__)"
}
11 changes: 6 additions & 5 deletions awscli/customizations/s3/transferconfig.py
Original file line number Diff line number Diff line change
@@ -91,12 +91,13 @@ def create_transfer_config_from_runtime_config(runtime_config):
"""
translation_map = {
'max_concurrent_requests': 'max_request_concurrency',
'max_queue_size': 'max_request_queue_size'
'max_queue_size': 'max_request_queue_size',
'multipart_threshold': 'multipart_threshold',
'multipart_chunksize': 'multipart_chunksize',
}
kwargs = {}

for key, value in runtime_config.items():
new_key = translation_map.get(key, key)
kwargs[new_key] = value

if key not in translation_map:
continue
kwargs[translation_map[key]] = value
return TransferConfig(**kwargs)
8 changes: 7 additions & 1 deletion tests/unit/customizations/s3/test_transferconfig.py
Original file line number Diff line number Diff line change
@@ -77,11 +77,17 @@ def test_convert(self):
'multipart_threshold': 1,
'multipart_chunksize': 2,
'max_concurrent_requests': 3,
'max_queue_size': 4
'max_queue_size': 4,
'addressing_style': 'path',
'use_accelerate_endpoint': True,
# This is a TransferConfig only option, it should
# just be ignored if it's in the ~/.aws/config for now.
'max_in_memory_upload_chunks': 1000,
}
result = transferconfig.create_transfer_config_from_runtime_config(
runtime_config)
self.assertEqual(result.multipart_threshold, 1)
self.assertEqual(result.multipart_chunksize, 2)
self.assertEqual(result.max_request_concurrency, 3)
self.assertEqual(result.max_request_queue_size, 4)
self.assertNotEqual(result.max_in_memory_upload_chunks, 1000)