From 03c2b5d6e0eb5e391ec933cd44dbc71b4ab62828 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Thu, 2 Sep 2021 19:30:41 +0100 Subject: [PATCH 1/2] lowercase username --- roles/jupyterhub/templates/patch_await.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/roles/jupyterhub/templates/patch_await.sh b/roles/jupyterhub/templates/patch_await.sh index a9ea8c9a9..bf4346413 100755 --- a/roles/jupyterhub/templates/patch_await.sh +++ b/roles/jupyterhub/templates/patch_await.sh @@ -4,9 +4,16 @@ SITE_PACKAGES=$({{ jupyterhub_venv }}/bin/getsite.py) cat $SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py |grep 'await self.render' if [ $? -ne 0 ];then - echo Updating file + echo Updating to \"await self.render\" sed -i -e's/self.render/await self.render/' $SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py else - echo Patch already applied. Skipping. . . + echo Await patch already applied. Skipping. . . +fi +cat $SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py |grep data['data'].lower()' +if [ $? -ne 0 ];then + echo Updating to data['username'].lower() + sed -i -e's/data['username']/data['username'].lower()/' $SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py +else + echo username.lower() patch already applied. Skipping. . . fi From 979270dcc267fb106e74a8f899a4ca6e7bb11dd1 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Thu, 2 Sep 2021 21:14:17 +0100 Subject: [PATCH 2/2] escaping sed quotes correctly --- roles/jupyterhub/templates/patch_await.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/jupyterhub/templates/patch_await.sh b/roles/jupyterhub/templates/patch_await.sh index bf4346413..50b292535 100755 --- a/roles/jupyterhub/templates/patch_await.sh +++ b/roles/jupyterhub/templates/patch_await.sh @@ -9,11 +9,11 @@ if [ $? -ne 0 ];then else echo Await patch already applied. Skipping. . . fi -cat $SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py |grep data['data'].lower()' +cat $SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py |grep "data\['username'\].lower\(\)" if [ $? -ne 0 ];then - echo Updating to data['username'].lower() - sed -i -e's/data['username']/data['username'].lower()/' $SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py + echo Updating to data['username'].lower\(\) + sed -i -e"s/data\['username'\]/data\['username'\].lower\(\)/" $SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py else - echo username.lower() patch already applied. Skipping. . . + echo username.lower\(\) patch already applied. Skipping. . . fi