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

Taskcat Does Not Read Credentials From Environmental Variables #790

Open
evanottinger opened this issue Mar 17, 2023 · 0 comments
Open

Taskcat Does Not Read Credentials From Environmental Variables #790

evanottinger opened this issue Mar 17, 2023 · 0 comments

Comments

@evanottinger
Copy link

Describe the bug
Taskcat does not read credentials from environmental variables.

To Reproduce
Steps to reproduce the behavior:

  1. Export AWS credentials to environmental variables.
  2. Run taskcat.
  3. Taskcat reports error: botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied

Stack Trace:

[ERROR  ] : ClientError An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied
Traceback (most recent call last):
  File "/home/evan/.local/lib/python3.10/site-packages/taskcat/_cli.py", line 46, in main
    cli.run()
  File "/home/evan/.local/lib/python3.10/site-packages/taskcat/_cli_core.py", line 316, in run
    return getattr(command(), subcommand)(**args)
  File "/home/evan/.local/lib/python3.10/site-packages/taskcat/_cli_modules/test.py", line 167, in run
    with test:
  File "/home/evan/.local/lib/python3.10/site-packages/taskcat/testing/base_test.py", line 58, in __enter__
    raise ex
  File "/home/evan/.local/lib/python3.10/site-packages/taskcat/testing/base_test.py", line 55, in __enter__
    self.run()
  File "/home/evan/.local/lib/python3.10/site-packages/taskcat/testing/_cfn_test.py", line 104, in run
    stage_in_s3(
  File "/home/evan/.local/lib/python3.10/site-packages/taskcat/_s3_stage.py", line 40, in stage_in_s3
    pool.map(func, distinct_buckets.values())
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 367, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/home/evan/.local/lib/python3.10/site-packages/taskcat/_s3_stage.py", line 49, in _sync_wrap
    S3Sync(
  File "/home/evan/.local/lib/python3.10/site-packages/taskcat/_s3_sync.py", line 53, in __init__
    s3_file_list = self._get_s3_file_list(bucket, prefix)
  File "/home/evan/.local/lib/python3.10/site-packages/taskcat/_s3_sync.py", line 130, in _get_s3_file_list
    resp = self.s3_client.list_objects_v2(Bucket=bucket, Prefix=prefix)
  File "/home/evan/.local/lib/python3.10/site-packages/botocore/client.py", line 530, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/evan/.local/lib/python3.10/site-packages/botocore/client.py", line 960, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied

Expected behavior
taskcat should inherit config precedence of boto3 when initializing clients.

Screenshots
N/A

**Version (Please make sure you are running the latest version of taskcat)

  • Taskcat Version: 0.9.36

Note: Python Version 3.10.6

To find versions:
Via taskcat: taskcat -V
Via pip3: pip3 show taskcat

Note: both version should match

To update taskcat run:
for docker : docker pull taskcat/taskcat
for pip3: pip3 install --upgrade taskcat

Additional context
Validated that both the aws-cli and boto3 within the Python3 REPL were able to execute the the commands from the stack trace. I was able to get taskcat to run properly by adding a new profile to the credentials file and placing my credentials there. This was not a necessary step for aws-cli or for boto3.

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

No branches or pull requests

1 participant