From f2897897146af3e58a121246e87f548d5633125e Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 15 Aug 2016 14:06:38 +0200 Subject: [PATCH] log errors adding users already in db avoids removal of system users preventing Hub startup --- jupyterhub/app.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jupyterhub/app.py b/jupyterhub/app.py index ba42fae781..4ab06e67ce 100644 --- a/jupyterhub/app.py +++ b/jupyterhub/app.py @@ -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.