Skip to content

Using boto3 in a python3 sensor gives a RecursionError when building boto sensor #4975

@punkrokk

Description

@punkrokk

SUMMARY

Initializing a boto3 client with a python3 sensor results in a RecursionError

STACKSTORM VERSION

st2 3.2.0, on Python 3.6.8

OS, environment, install method

Post what OS you are running this on, along with any other relevant information/

CentOS 8, ansible

Steps to reproduce the problem

Show how to reproduce the problem, using a minimal test-case. Make sure to include any content

    import boto3
    from botocore.exceptions import ClientError

    self.boto3_client = 'guardduty'

    client = boto3.client(self.boto3_client,
                              aws_access_key_id=self.key,
                              aws_secret_access_key=self.secret,
                              region_name=self.region)

Expected Results

We can create the client

Actual Results

File "/opt/stackstorm/packs/aws_guardduty/lib/base_guardduty_sensor.py", line 146, in make_client
    region_name=region)
  File "/opt/stackstorm/virtualenvs/aws_guardduty/lib/python3.6/site-packages/boto3/__init__.py", line 91, in client
    return _get_default_session().client(*args, **kwargs)
  File "/opt/stackstorm/virtualenvs/aws_guardduty/lib/python3.6/site-packages/boto3/session.py", line 263, in client
    aws_session_token=aws_session_token, config=config)
  File "/opt/stackstorm/virtualenvs/aws_guardduty/lib/python3.6/site-packages/botocore/session.py", line 835, in create_client
    client_config=config, api_version=api_version)
  File "/opt/stackstorm/virtualenvs/aws_guardduty/lib/python3.6/site-packages/botocore/client.py", line 85, in create_client
    verify, credentials, scoped_config, client_config, endpoint_bridge)
  File "/opt/stackstorm/virtualenvs/aws_guardduty/lib/python3.6/site-packages/botocore/client.py", line 287, in _get_client_args
    verify, credentials, scoped_config, client_config, endpoint_bridge)
  File "/opt/stackstorm/virtualenvs/aws_guardduty/lib/python3.6/site-packages/botocore/args.py", line 107, in get_client_args
    client_cert=new_config.client_cert)
  File "/opt/stackstorm/virtualenvs/aws_guardduty/lib/python3.6/site-packages/botocore/endpoint.py", line 298, in create_endpoint
    client_cert=client_cert,
  File "/opt/stackstorm/virtualenvs/aws_guardduty/lib/python3.6/site-packages/botocore/httpsession.py", line 180, in __init__
    self._manager = PoolManager(**self._get_pool_manager_kwargs())
  File "/opt/stackstorm/virtualenvs/aws_guardduty/lib/python3.6/site-packages/botocore/httpsession.py", line 188, in _get_pool_manager_kwargs
    'ssl_context': self._get_ssl_context(),
  File "/opt/stackstorm/virtualenvs/aws_guardduty/lib/python3.6/site-packages/botocore/httpsession.py", line 197, in _get_ssl_context
    return create_urllib3_context()
  File "/opt/stackstorm/virtualenvs/aws_guardduty/lib/python3.6/site-packages/botocore/httpsession.py", line 72, in create_urllib3_context
    context.options |= options
  File "/usr/lib64/python3.6/ssl.py", line 423, in options
    super(SSLContext, SSLContext).options.__set__(self, value)
  File "/usr/lib64/python3.6/ssl.py", line 423, in options
    super(SSLContext, SSLContext).options.__set__(self, value)
  File "/usr/lib64/python3.6/ssl.py", line 423, in options
    super(SSLContext, SSLContext).options.__set__(self, value)
  [Previous line repeated 323 more times]
RecursionError: maximum recursion depth exceeded

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions