Skip to content
Draft
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion sarc/users/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,15 @@ def _merge_and_update(self, db_user: UserDB, user: UserMatch) -> None:
)
for name, creds in user.associated_accounts.items():
if name in db_user.associated_accounts:
db_user.associated_accounts[name].merge_with(creds)
try:
db_user.associated_accounts[name].merge_with(creds)
except DateOverlapError as e:
logger.error(
"Can't update associated_accounts[%s] for user %s, date overlap error: %s",
name,
db_user.uuid,
e,
)
else:
db_user.associated_accounts[name] = creds
self._update_supervisors(db_user, user)
Expand Down
4 changes: 2 additions & 2 deletions sarc/users/legacy_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ def parse_user_data(self, data: bytes) -> Iterable[UserMatch]:

# Add associated accounts
# Mila account
if record.get("mila_ldap", {}).get("status") == "enabled":
if record.get("mila", {}).get("active", False):
mila_creds = Credentials()
mila_creds.insert(
record["mila_ldap"]["mila_cluster_username"],
record["mila"]["username"],
record_start,
record_end,
)
Expand Down