Incorrect logic when `fail_if_noauth=True` in client initialization
I found this in an investigation as to why I was not able to authenticate to the server properly. I instantiated a rest client with fail_if_noauth=True
to force the client to tell me something about my credentials. This seems to have revealed a (probably unrelated) bug. I think the logic on this line:
https://git.ligo.org/lscsoft/gracedb-client/blob/master/ligo/gracedb/rest.py#L198
Should actually be:
if (fail_if_noauth and self.credentials == {}):
raise RuntimeError('No authentication credentials found')
It current checks for fail_if_noauth
and not force_noauth
which are mutually exclusive options and the logic will be true by construction if fail_if_noauth == True
and not force_noauth == True
, the latter of which is default.
I can confirm with a pdb
session that running the current code with the indicated arguments produces a spurious RuntimeError
even when credentials (the /tmp/x509_up...
file) are found.