From 54c9512e48f191cd028f253977133839c279ab2a Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 1 Mar 2019 18:31:11 +0100 Subject: [PATCH] Add a sleep after running the workspace mount process. It runs in background so the workspace risks to not be available before the user tries to use it. --- smartgears/r_connector/defaults/main.yml | 1 + smartgears/r_connector/templates/rusersadd.j2 | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/smartgears/r_connector/defaults/main.yml b/smartgears/r_connector/defaults/main.yml index cf663534..b3ccb21a 100644 --- a/smartgears/r_connector/defaults/main.yml +++ b/smartgears/r_connector/defaults/main.yml @@ -11,6 +11,7 @@ r_connector_userconfig: userconfig.csv r_connector_adduserscript: /usr/local/bin/rusersadd r_connector_workspace_unmount: /usr/local/bin/rconnector_unmount r_connector_workspace_mountpoint: workspace +r_connector_sleep_after_mount: 5 r_connector_rstudio_cookie_key: /var/lib/rstudio-server/secure-cookie-key r_connector_rprofile_svn_url: 'http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/RConfiguration/RStudioConfiguration' r_connector_rprofile_filename: '.Rprofile' diff --git a/smartgears/r_connector/templates/rusersadd.j2 b/smartgears/r_connector/templates/rusersadd.j2 index 8ceddc9a..07de4cc4 100755 --- a/smartgears/r_connector/templates/rusersadd.j2 +++ b/smartgears/r_connector/templates/rusersadd.j2 @@ -11,6 +11,7 @@ USER="$1" GCUBE_TOKEN= GCUBE_SCOPES= REMOTE_WORKSPACE_MOUNT=0 +SLEEP_AFTER_MOUNT={{ r_connector_sleep_after_mount }} if [ $# -ne 3 ] ; then REMOTE_WORKSPACE_MOUNT=1 logger "$LOG_PREFIX: this rconnector does not support the remote workspace mount" @@ -35,6 +36,7 @@ workspace_mount () { sudo /bin/mkdir -p "$WORKSPACE_MOUNT_DIR" sudo /bin/chown "${USER}" "$WORKSPACE_MOUNT_DIR" sudo -u "$USER" /usr/bin/java -jar $FUSE_INTEGRATION_JAR $GCUBE_TOKEN $GCUBE_SCOPES $WORKSPACE_MOUNT_DIR > "/var/tmp/workspace_${USER}.log" 2>&1 & + sleep $SLEEP_AFTER_MOUNT fi } @@ -44,6 +46,10 @@ fix_userconfig_perms () { sudo /bin/chown "${USER}:{{ smartgears_user }}" "$HDIR/{{ r_connector_userconfig }}" sudo /usr/bin/setfacl -m u:${USER}:rw,g:{{ smartgears_user }}:rw $HDIR/{{ r_connector_userconfig }} } + +# +# Main +# if [ -d "$HDIR" ] ; then if id -u "$USER" >/dev/null 2>&1 then