Skip to content

Commit

Permalink
Merge pull request #207 from mila-iqia/handle-authentication-with-lac…
Browse files Browse the repository at this point in the history
…k-of-db

Handle connection exception when checking the user
  • Loading branch information
soline-b authored Nov 4, 2024
2 parents f61e2be + 4d32e5a commit a918935
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion clockwork_web/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ def get(mila_email_username: str):

mc = get_db()

L = list(mc["users"].find({"mila_email_username": mila_email_username}))
try:
L = list(mc["users"].find({"mila_email_username": mila_email_username}))
except:
return None

# This is not an error from which we expect to be able to recover gracefully.
# It could happen if you copied data from your database directly
# using an external script, and ended up with many instances of your users.
Expand Down
1 change: 1 addition & 0 deletions scripts/ensure_one_fake_admin_in_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Helper script to make sure testing db contains at least 1 admin user.
Used for frontend admin tests.
"""

from slurm_state.mongo_client import get_mongo_client
from slurm_state.config import get_config

Expand Down

0 comments on commit a918935

Please sign in to comment.