Skip to content

Commit

Permalink
Merge pull request #217 from tpcstld/jj_change_creds
Browse files Browse the repository at this point in the history
Change get_aws_credentials_from_file to load in the same order that boto does.
  • Loading branch information
sb2nov committed Feb 2, 2016
2 parents 875c308 + 5097acb commit fc181de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dataduct/config/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,22 @@ def get_aws_credentials_from_iam():


def get_aws_credentials_from_file(filename=None):
"""Get the aws from credential files
"""Get the AWS credentials from boto config files
Tries to load from the specified filename, if applicable, else follows what
boto does by following the order specified at
http://boto.cloudhackers.com/en/latest/boto_config_tut.html#details
"""
config = SafeConfigParser()
cred_file = None
if filename is not None and os.path.isfile(filename):
cred_file = filename
elif os.path.isfile('/etc/boto.cfg'):
cred_file = '/etc/boto.cfg'
elif os.path.isfile(os.path.expanduser('~/.boto')):
cred_file = os.path.expanduser('~/.boto')
elif os.path.isfile(os.path.expanduser('~/.aws/credentials')):
cred_file = os.path.expanduser('~/.aws/credentials')
elif os.path.isfile(os.path.expanduser('~/.boto')):
cred_file = os.path.expanduser('~/.boto')
else:
raise Exception("Cannot find a credentials file")

Expand Down
3 changes: 3 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ The major dependencies of dataduct are:
- ``pyparsing``
- ``testfixtures``

Ensure that a `boto config file <http://boto.cloudhackers.com/en/latest/boto_config_tut.html>`__
containing proper AWS credentials is present.

The visualizations are created using:

- ``graphviz``
Expand Down

0 comments on commit fc181de

Please sign in to comment.