Commit 77709826 by rfkelly0

S3FS: check for AWS_* environ variables and fail early if missing.

This closes issue #41.
parent 6c6e44a1
...@@ -9,6 +9,7 @@ interface for objects stored in Amazon Simple Storage Service (S3). ...@@ -9,6 +9,7 @@ interface for objects stored in Amazon Simple Storage Service (S3).
""" """
import os
import time import time
import datetime import datetime
import tempfile import tempfile
...@@ -88,6 +89,12 @@ class S3FS(FS): ...@@ -88,6 +89,12 @@ class S3FS(FS):
prefix = prefix[1:] prefix = prefix[1:]
if not prefix.endswith(separator) and prefix != "": if not prefix.endswith(separator) and prefix != "":
prefix = prefix + separator prefix = prefix + separator
if aws_access_key is None:
if "AWS_ACCESS_KEY_ID" not in os.environ:
raise CreateFailedError("AWS_ACCESS_KEY_ID not set")
if aws_secret_key is None:
if "AWS_SECRET_ACCESS_KEY" not in os.environ:
raise CreateFailedError("AWS_SECRET_ACCESS_KEY not set")
self._prefix = prefix self._prefix = prefix
self._tlocal = thread_local() self._tlocal = thread_local()
super(S3FS, self).__init__(thread_synchronize=thread_synchronize) super(S3FS, self).__init__(thread_synchronize=thread_synchronize)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment