From 5fc9d78a1f8b6d9f422564fdcf2c76cde4a3c347 Mon Sep 17 00:00:00 2001 From: Cocoa Oikawa <0xbbc@0xbbc.com> Date: Thu, 5 Jul 2018 15:20:50 +0800 Subject: [PATCH] in case of newline at the end of userlist file It's a habit for some developers to append a newline at the end of the file, but line 82 did not take this into consideration. And the consequence is that JupyterHub would keep restarting. --- jupyterhub_config.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/jupyterhub_config.py b/jupyterhub_config.py index c81161b..aef784c 100644 --- a/jupyterhub_config.py +++ b/jupyterhub_config.py @@ -78,7 +78,9 @@ with open(os.path.join(pwd, 'userlist')) as f: if not line: continue parts = line.split() - name = parts[0] - whitelist.add(name) - if len(parts) > 1 and parts[1] == 'admin': - admin.add(name) + # in case of newline at the end of userlist file + if len(parts) >= 1: + name = parts[0] + whitelist.add(name) + if len(parts) > 1 and parts[1] == 'admin': + admin.add(name)