Skip to content

Commit

Permalink
Jupyterhub: allow users created before Cowbird was enabled to spawn j…
Browse files Browse the repository at this point in the history
…upyterlab
  • Loading branch information
mishaschwartz committed Nov 22, 2024
1 parent 8dcb5a3 commit 9b7121a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 13 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,19 @@
[Unreleased](https://github.com/bird-house/birdhouse-deploy/tree/master) (latest)
------------------------------------------------------------------------------------------------------------------

[//]: # (list changes here, using '-' for each new entry, remove this when items are added)
## 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.

[2.6.1](https://github.com/bird-house/birdhouse-deploy/tree/2.6.1) (2024-11-22)
------------------------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down

0 comments on commit 9b7121a

Please sign in to comment.