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

Handle case when s3 config key is not a dict #858

Merged
merged 1 commit into from
Mar 30, 2016

Conversation

jamesls
Copy link
Member

@jamesls jamesls commented Mar 30, 2016

This fixes a regression for the error case when a user
has an invalid CLI config file. Examples include:

[default]
s3 = foo

[profile foo]
s3 =
signature_version = s3v4

Previously, we would check that the 's3' key was a dict type
before trying to access values. This puts back the old
behavior.

Long term, we're going to need something that properly validates
the config keys and gives good error messages for these conditions.

Without this change you'd get this:

Traceback (most recent call last):
  File "aws-cli/awscli/clidriver.py", line 186, in main
    return command_table[parsed_args.command](remaining, parsed_args)
  File "aws-cli/awscli/clidriver.py", line 379, in __call__
    return command_table[parsed_args.operation](remaining, parsed_globals)
  File "aws-cli/awscli/clidriver.py", line 548, in __call__
    call_parameters, parsed_globals)
  File "aws-cli/awscli/clidriver.py", line 665, in invoke
    verify=parsed_globals.verify_ssl)
  File "botocore/botocore/session.py", line 814, in create_client
    client_config=config, api_version=api_version)
  File "botocore/botocore/client.py", line 62, in create_client
    verify, credentials, scoped_config, client_config)
  File "botocore/botocore/client.py", line 182, in _get_client_args
    new_config = Config(**config_kwargs)
  File "botocore/botocore/config.py", line 95, in __init__
    self._validate_s3_configuration(self.s3)
  File "botocore/botocore/config.py", line 132, in _validate_s3_configuration
    addressing_style = s3.get('addressing_style')
AttributeError: 'str' object has no attribute 'get'

cc @kyleknap @JordonPhillips

This fixes a regression for the error case when a user
has an invalid CLI config file.  Examples include:

```
[default]
s3 = foo

[profile foo]
s3 =
signature_version = s3v4
```

Previously, we would check that the 's3' key was a dict type
before trying to access values.  This puts back the old
behavior.

Long term, we're going to need something that properly validates
the config keys and gives good error messages for these conditions.
@kyleknap
Copy link
Contributor

🚢

@JordonPhillips
Copy link
Contributor

@jamesls jamesls merged commit 40e080a into boto:develop Mar 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants