jorgebastida / jorgebastida/awslogs
Crashes when using profile
- Dominant language
- Python
- Stars
- 5k
- Forks
- 342
- PR merge metrics
- No merged PRs in 30d
Description
I executed command below with a profile, and crashed with RegionError
```
$ awslogs groups --profile some_profile
================================================================================
You've found a bug! Please, raise an issue attaching the following traceback
https://github.com/jorgebastida/awslogs/issues/new
--------------------------------------------------------------------------------
Version: 0.8.0
Python: 2.7.8 (default, Sep 28 2014, 21:56:30)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)]
boto3 version: 1.4.4
Platform: Darwin-15.6.0-x86_64-i386-64bit
Config: {'func': 'list_groups', 'aws_region': None, 'log_group_prefix': None, 'aws_session_token': 'SENSITIVE', 'aws_profile': 'SENSITIVE', 'aws_secret_access_key': 'SENSITIVE', 'aws_access_key_id': 'SENSITIVE'}
Args: ['/Users/kawasakitoshiya/.virtualenvs/default/bin/awslogs', 'groups', '--profile', 'some_profile']
Traceback (most recent call last):
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/awslogs/bin.py", line 168, in main
logs = AWSLogs(**vars(options))
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/awslogs/core.py", line 61, in __init__
region_name=self.aws_region
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/boto3/__init__.py", line 83, in client
return _get_default_session().client(*args, **kwargs)
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/boto3/session.py", line 263, in client
aws_session_token=aws_session_token, config=config)
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/botocore/session.py", line 836, in create_client
client_config=config, api_version=api_version)
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/botocore/client.py", line 70, in create_client
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/botocore/client.py", line 224, in _get_client_args
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/botocore/args.py", line 45, in get_client_args
endpoint_url, is_secure, scoped_config)
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/botocore/args.py", line 103, in compute_client_args
service_name, region_name, endpoint_url, is_secure)
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/botocore/client.py", line 297, in resolve
service_name, region_name)
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/botocore/regions.py", line 122, in construct_endpoint
partition, service_name, region_name)
File "/Users/kawasakitoshiya/.virtualenvs/default/lib/python2.7/site-packages/botocore/regions.py", line 135, in _endpoint_for_partition
raise NoRegionError()
NoRegionError: You must specify a region.
================================================================================
```
aws config file is ...
```
$ cat ~/.aws/config
[default]
output = text
region = ap-northeast-1
[profile some_profile]
role_arn = arn:aws:iam::xxxxxxxxxxx:role/SomeRole
source_profile = default
```
Once I append region to the profile section, the command worked correctly.
```
$ cat ~/.aws/config
[default]
output = text
region = ap-northeast-1
[profile some_profile]
role_arn = arn:aws:iam::xxxxxxxxxxx:role/SomeRole
source_profile = default
region = ap-northeast-1
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with awslogs/bin.py main and awslogs/core.py AWSLogs initialization, then reproduce `awslogs groups --profile some_profile` using the configuration shown. Trace how the selected profile and region reach the boto3 client. Done means the command no longer raises NoRegionError with that profile configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100