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

Thread safe AWS account name resolution #73

Merged
merged 1 commit into from
Apr 13, 2018

Conversation

s-maj
Copy link

@s-maj s-maj commented Apr 11, 2018

When --resolve-aliases is used, it is possible to receive (from time to time) exception:

Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/site-packages/aws_google_auth/amazon.py", line 76, in resolve_aws_alias
    sts = boto3.client('sts', region_name=self.config.region)
  File "/usr/local/lib/python3.6/site-packages/boto3/__init__.py", line 83, in client
    return _get_default_session().client(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/boto3/session.py", line 263, in client
    aws_session_token=aws_session_token, config=config)
  File "/usr/local/lib/python3.6/site-packages/botocore/session.py", line 851, in create_client
    endpoint_resolver = self.get_component('endpoint_resolver')
  File "/usr/local/lib/python3.6/site-packages/botocore/session.py", line 726, in get_component
    return self._components.get_component(name)
  File "/usr/local/lib/python3.6/site-packages/botocore/session.py", line 926, in get_component
    del self._deferred[name]
KeyError: 'endpoint_resolver'

This issue is related to boto/boto3#801

One session per thread should fix this.

@coveralls
Copy link

coveralls commented Apr 11, 2018

Coverage Status

Coverage increased (+0.003%) to 49.068% when pulling b075b1c on s-maj:threadsafe into 9ffde70 on cevoaustralia:master.

Copy link
Contributor

@stevemac007 stevemac007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the contribution.

@stevemac007
Copy link
Contributor

Will merge and release new version shortly.

@stevemac007 stevemac007 merged commit f8d8570 into cevoaustralia:master Apr 13, 2018
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