Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion velociraptor/1.0.0/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,20 @@ def __init__(self, redis, logger, console_logger=None):
super().__init__(redis, logger, console_logger)

def auth(self, api_config):
credfile = self.get_file(api_config)["data"]
# get_file() returns None when the worker cannot reach the Shuffle
# files API (e.g. distributed/org runtimes). Guard it, and fall back to
# treating api_config as the credential contents themselves, so the
# config can also be supplied inline. Raise a clear error otherwise
# instead of the opaque "'NoneType' object is not subscriptable".
_f = self.get_file(api_config)
credfile = _f["data"] if isinstance(_f, dict) and _f.get("data") else api_config
if not credfile:
raise ValueError(
"Velociraptor: could not load the API credential. get_file() "
"returned no data - the worker may be unable to reach the "
"Shuffle files API. Provide the api.config.yaml contents in the "
"authentication field."
)
config = yaml.load(credfile, Loader=yaml.FullLoader)
creds = grpc.ssl_channel_credentials(
root_certificates=config["ca_certificate"].encode("utf8"),
Expand Down