fugue / credstash

A little utility for managing credentials in the cloud
Apache License 2.0
2.06k stars 215 forks source link

Credstash unable to retrieve credentials using profile after upgrading to 1.16.2 #272

Closed leandrocostam closed 4 years ago

leandrocostam commented 4 years ago

If you are trying to use credstash 1.16.2 by specifying profile, it is not able to retrieve the credentials. Please refer the following log:

$ credstash --profile <profile_name> list
2020-02-17 11:52:49,596 ERROR Unable to locate credentials
Traceback (most recent call last):
  File "/usr/local/bin/credstash.py", line 262, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/bin/credstash.py", line 592, in createDdbTable
    if table in (t.name for t in dynamodb.tables.all()):
  File "/usr/local/bin/credstash.py", line 592, in <genexpr>
    if table in (t.name for t in dynamodb.tables.all()):
  File "/usr/local/lib/python3.7/site-packages/boto3/resources/collection.py", line 83, in __iter__
    for page in self.pages():
  File "/usr/local/lib/python3.7/site-packages/boto3/resources/collection.py", line 166, in pages
    for page in pages:
  File "/usr/local/lib/python3.7/site-packages/botocore/paginate.py", line 255, in __iter__
    response = self._make_request(current_kwargs)
  File "/usr/local/lib/python3.7/site-packages/botocore/paginate.py", line 332, in _make_request
    return self._method(**current_kwargs)
  File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 613, in _make_api_call
    operation_model, request_dict, request_context)
  File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 632, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/usr/local/lib/python3.7/site-packages/botocore/endpoint.py", line 102, in make_request
    return self._send_request(request_dict, operation_model)
  File "/usr/local/lib/python3.7/site-packages/botocore/endpoint.py", line 132, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/usr/local/lib/python3.7/site-packages/botocore/endpoint.py", line 116, in create_request
    operation_name=operation_model.name)
  File "/usr/local/lib/python3.7/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/lib/python3.7/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/usr/local/lib/python3.7/site-packages/botocore/signers.py", line 90, in handler
    return self.sign(operation_name, request)
  File "/usr/local/lib/python3.7/site-packages/botocore/signers.py", line 160, in sign
    auth.add_auth(request)
  File "/usr/local/lib/python3.7/site-packages/botocore/auth.py", line 357, in add_auth
    raise NoCredentialsError
botocore.exceptions.NoCredentialsError: Unable to locate credentials

If you downgrade the version to 1.16.1 by running the command pip install credstash==1.16.1, it works properly. I am using the following boto and botocore versions:

$ pip show boto3 botocore
Name: boto3
Version: 1.12.0
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: UNKNOWN
License: Apache License 2.0
Location: /usr/local/lib/python3.7/site-packages
Requires: jmespath, botocore, s3transfer
Required-by: -redstash, credstash, awslogs
---
Name: botocore
Version: 1.15.0
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: UNKNOWN
License: Apache License 2.0
Location: /usr/local/lib/python3.7/site-packages
Requires: docutils, jmespath, python-dateutil, urllib3
Required-by: ec2instanceconnectcli, s3transfer, boto3, awscli
chenrui333 commented 4 years ago

@leandrocostam, you can try brew install credstash after the upgrade merge, I just tested the command, it works well for me.

$ /usr/local/Cellar/credstash/1.16.2/bin/credstash --profile xx list
a.new.testing.key                   -- version 0000000000000000000 -- comment
airflow.mysql.password.airflow_user -- version 0000000000000000000 -- comment
datadog.key                         -- version 0000000000000000000 -- comment
ecs.instance.userdata               -- version 0000000000000000000 -- comment
fastly.api.purgetoken               -- version 0000000000000000000 -- comment
leandrocostam commented 4 years ago

@chenrui333 Thanks for that. Now it works just fine.

chenrui333 commented 4 years ago

np