From 662a889c6850d252a9939b6eb7abdb50cbf5a981 Mon Sep 17 00:00:00 2001 From: Steven DeMartini <1647130+sjdemartini@users.noreply.github.com> Date: Thu, 21 Apr 2022 06:18:55 -0700 Subject: [PATCH] Only create symlink /share if /home/share exists (#125) We never added a `/home/share` and don't intend to create one, so this makes the existing prologue work without issue for our scenario. Without this, the prologue always creates a "dead" symlink that points to a non-existent directory, which appears broken in the JupyterHub notebook interface as well. Co-authored-by: Steven DeMartini --- roles/jupyterhub/templates/jupyterhub_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/jupyterhub/templates/jupyterhub_config.py b/roles/jupyterhub/templates/jupyterhub_config.py index 30c46afb..c0b92259 100644 --- a/roles/jupyterhub/templates/jupyterhub_config.py +++ b/roles/jupyterhub/templates/jupyterhub_config.py @@ -240,8 +240,8 @@ class QHubHPCSpawner(QHubHPCSpawnerBase): c.QHubHPCSpawner.req_nprocs = '1' c.QHubHPCSpawner.req_conda_environment_prefix = '{{ miniforge_home }}/envs/{{ jupyterhub_lab_environment | basename | splitext | first }}' c.QHubHPCSpawner.req_prologue = ''' -# ensure user has link to shared directory -if [ ! -L "$HOME/share" ]; then +# ensure user has link to the shared directory, if it exists +if [ -d "/home/share" ] && [ ! -L "$HOME/share" ]; then ln -s /home/share "$HOME/share" fi