Skip to content

Commit

Permalink
Add Note section to setAwsEnvCredentials. Fix missing credentials che…
Browse files Browse the repository at this point in the history
…ck in test_butler.
  • Loading branch information
DinoBektesevic committed Aug 20, 2019
1 parent 1d0939d commit aa54f1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions python/lsst/daf/butler/core/s3utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ def setAwsEnvCredentials(accessKeyId='dummyAccessKeyId', secretAccessKey="dummyS
-------
setEnvCredentials : `bool`
True when environmental variables were set, False otherwise.
Note
----
If either AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY are not set, both
values are overwritten.
"""
if "AWS_ACCESS_KEY_ID" not in os.environ or "AWS_SECRET_ACCESS_KEY" not in os.environ:
os.environ["AWS_ACCESS_KEY_ID"] = accessKeyId
Expand Down
3 changes: 2 additions & 1 deletion tests/test_butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,8 @@ def tearDown(self):
bucket.delete()

# unset any potentially set dummy credentials
unsetAwsEnvCredentials()
if self.usingDummyCredentials:
unsetAwsEnvCredentials()

def checkFileExists(self, root, relpath):
"""Checks if file exists at a given path (relative to root).
Expand Down

0 comments on commit aa54f1b

Please sign in to comment.