diff --git a/roles/jupyterhub/tasks/install.yml b/roles/jupyterhub/tasks/install.yml index a4c2a2276..436488ac7 100644 --- a/roles/jupyterhub/tasks/install.yml +++ b/roles/jupyterhub/tasks/install.yml @@ -59,16 +59,22 @@ src: jupyterhub.service.j2 dest: /etc/systemd/system/jupyterhub.service -- name: Install script from template to fix the async bug in firseuseauthenticator +- name: Install script from template, to fix the async bug in firseuseauthenticator template: src: patch_await.sh.j2 dest: "{{ jupyterhub_venv }}/bin/patch_await.sh" mode: 0755 -- name: "Now run it: {{ jupyterhub_venv }}/bin/patch_await.sh" +- name: Install {{ jupyterhub_venv }}/bin/getsite.py from template, to fetch the site_packages path + template: + src: getsite.py.j2 + dest: "{{ jupyterhub_venv }}/bin/getsite.py" + mode: 0755 + +- name: "Run the above two, via: {{ jupyterhub_venv }}/bin/patch_await.sh" command: "{{ jupyterhub_venv }}/bin/patch_await.sh" -- name: Install script from template to turn off the warning about http insecurity +- name: Install script from template, to turn off the warning about http insecurity template: src: patch-http-warning.sh.j2 dest: "{{ jupyterhub_venv }}/bin/patch_http-warning.sh" diff --git a/roles/jupyterhub/templates/getsite.py.j2 b/roles/jupyterhub/templates/getsite.py.j2 new file mode 100755 index 000000000..961d9d695 --- /dev/null +++ b/roles/jupyterhub/templates/getsite.py.j2 @@ -0,0 +1,7 @@ +#!{{ jupyterhub_venv }}/bin/python3 + +import site + +for path in iter(site.getsitepackages()): + if path.find('site') != -1: + print(path) diff --git a/roles/jupyterhub/templates/patch_await.sh.j2 b/roles/jupyterhub/templates/patch_await.sh.j2 index 39932815b..2394eb9f1 100644 --- a/roles/jupyterhub/templates/patch_await.sh.j2 +++ b/roles/jupyterhub/templates/patch_await.sh.j2 @@ -1,10 +1,9 @@ #!/bin/bash -x # add await to asyncio change password function -# SITE_PACKAGES=$({{ jupyterhub_venv }}/bin/python -m site | grep -v exist | grep site) -# SITE_PACKAGES=${SITE_PACKAGES:5:-2} +# SITE_PACKAGES=$({{ jupyterhub_venv }}/bin/python -m site | grep {{ jupyterhub_venv }} | grep /site-packages | cut -d\' -f2) -SITE_PACKAGES=$({{ jupyterhub_venv }}/bin/python -m site | grep {{ jupyterhub_venv }} | grep /site-packages | cut -d\' -f2) +SITE_PACKAGES=$({{ jupyterhub_venv }}/bin/getsite.py) file=$SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py # file={{ jupyterhub_venv }}/lib/python{{ python_ver }}/site-packages/firstuseauthenticator/firstuseauthenticator.py