diff --git a/CHANGES.md b/CHANGES.md index c2dcd236..4aa73cf4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,20 @@ [Unreleased](https://github.com/bird-house/birdhouse-deploy/tree/master) (latest) ------------------------------------------------------------------------------------------------------------------ +## Fixes + +- Jupyterhub: allow users created before Cowbird was enabled to spawn jupyterlab + + Users created before Cowbird was enabled will not have a "workspace directory" created. A workspace directory + is a symlink to the directory that contains their Jupyterhub data. + + When Cowbird is enabled, Jupyterhub checks if the workspace directory exists and raises an error if it doesn't. + + This change allows Jupyterhub to create the symlink if it doesn't exist instead of raising an error. + This means that users without a "workspace directory" will be able to continue using Jupyterhub as they did + before without the need for manual intervention by a system administrator who would otherwise need to manually + create the symlink for them. + ## Changes - Fix help string description for `bin/birdhouse configs` command diff --git a/birdhouse/components/jupyterhub/jupyterhub_config.py.template b/birdhouse/components/jupyterhub/jupyterhub_config.py.template index 0fce675b..ff06c988 100644 --- a/birdhouse/components/jupyterhub/jupyterhub_config.py.template +++ b/birdhouse/components/jupyterhub/jupyterhub_config.py.template @@ -159,8 +159,7 @@ def create_dir_hook(spawner): # to have working volume mounts with the DockerSpawner. workspace_user_dir = join(os.environ['WORKSPACE_DIR'], username) if not os.path.exists(workspace_user_dir): - raise FileNotFoundError(f"The user {username}'s workspace doesn't exist in the workspace directory, " - "but should have been created by Cowbird already.") + os.symlink(jupyterhub_user_dir, workspace_user_dir, target_is_directory=True) subprocess.call(["chown", f"{os.environ['USER_WORKSPACE_UID']}:{os.environ['USER_WORKSPACE_GID']}", workspace_user_dir])