Skip to content

Commit

Permalink
log errors adding users already in db
Browse files Browse the repository at this point in the history
avoids removal of system users preventing Hub startup
  • Loading branch information
minrk committed Aug 15, 2016
1 parent 4edf59e commit f289789
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion jupyterhub/app.py
Expand Up @@ -855,7 +855,13 @@ def init_users(self):
# but changes to the whitelist can occur in the database,
# and persist across sessions.
for user in db.query(orm.User):
yield gen.maybe_future(self.authenticator.add_user(user))
try:
yield gen.maybe_future(self.authenticator.add_user(user))
except Exception:
# TODO: known cause of this is system users that have been removed.
# Should we be removing from the db in this case?
# API abtractions makes it hard to know that this is what happened at this level.
self.log.exception("Error adding user %r already in db", user.name)
db.commit() # can add_user touch the db?

# The whitelist set and the users in the db are now the same.
Expand Down

0 comments on commit f289789

Please sign in to comment.