From 8ae4d231e26cf990c28ef29a7abb09bbcb78e100 Mon Sep 17 00:00:00 2001 From: bsatoriu Date: Mon, 22 Feb 2021 13:45:31 -0800 Subject: [PATCH] Revert shared ws mount and remove read-only --- show_ssh_info/show_ssh_info/__init__.py | 3 ++- show_ssh_info/show_ssh_info/handlers.py | 5 +---- show_ssh_info/src/funcs.ts | 11 +++++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/show_ssh_info/show_ssh_info/__init__.py b/show_ssh_info/show_ssh_info/__init__.py index 1c7ac3b0..958021dd 100644 --- a/show_ssh_info/show_ssh_info/__init__.py +++ b/show_ssh_info/show_ssh_info/__init__.py @@ -2,7 +2,7 @@ import os import os.path from notebook.utils import url_path_join -from .handlers import GetHandler, InjectKeyHandler, MountBucketHandler, Presigneds3UrlHandler, MountSharedBucketsHandler +from .handlers import GetHandler, InjectKeyHandler, MountBucketHandler, Presigneds3UrlHandler, MountOrgBucketsHandler, MountSharedBucketsHandler def _jupyter_server_extension_paths(): return [{ @@ -27,5 +27,6 @@ def load_jupyter_server_extension(nb_server_app): web_app.add_handlers(host_pattern, [(url_path_join(base_url, 'show_ssh_info/inject_public_key'), InjectKeyHandler)]) web_app.add_handlers(host_pattern, [(url_path_join(base_url, 'show_ssh_info/mountBucket'), MountBucketHandler)]) web_app.add_handlers(host_pattern, [(url_path_join(base_url, 'show_ssh_info/mountSharedBucket'), MountSharedBucketsHandler)]) + web_app.add_handlers(host_pattern, [(url_path_join(base_url, 'show_ssh_info/getOrgs'), MountOrgBucketsHandler)]) web_app.add_handlers(host_pattern, [(url_path_join(base_url, 'show_ssh_info/getSigneds3Url'), Presigneds3UrlHandler)]) diff --git a/show_ssh_info/show_ssh_info/handlers.py b/show_ssh_info/show_ssh_info/handlers.py index 0ba7175a..3c521612 100644 --- a/show_ssh_info/show_ssh_info/handlers.py +++ b/show_ssh_info/show_ssh_info/handlers.py @@ -321,11 +321,8 @@ def get(self): message = umount_output logging.debug('umount output {}'.format(umount_output)) - # org folders are read-only (-o ro) - readonly_opt = '-o ro ' if org == 'maap-users' else '' mountdir_output = subprocess.check_output( - 's3fs -o iam_role=auto -o imdsv1only {} {} {}'.format( - readonly_opt, org_bucket_dir, org_workspace), + 's3fs -o iam_role=auto -o imdsv1only {} {}'.format(org_bucket_dir, org_workspace), shell=True).decode('utf-8') message = mountdir_output logging.debug('mountdir output {}'.format(mountdir_output)) diff --git a/show_ssh_info/src/funcs.ts b/show_ssh_info/src/funcs.ts index b4a5469e..cd497284 100644 --- a/show_ssh_info/src/funcs.ts +++ b/show_ssh_info/src/funcs.ts @@ -73,18 +73,21 @@ export async function mountUserFolder(state: IStateDB) { } export async function mountOrgFolders(state: IStateDB) { - var getUrl = new URL(PageConfig.getBaseUrl() + 'show_ssh_info/mountSharedBucket'); + // do something + let token = getToken(); + var getUrl = new URL(PageConfig.getBaseUrl() + 'show_ssh_info/getOrgs'); + getUrl.searchParams.append('token',token); request('get', getUrl.href).then((res: RequestResult) => { if (res.ok) { let data:any = JSON.parse(res.data); if (data.status_code == 200) { console.log(data); - INotification.success('Successfully mounted shared workspaces folders') + INotification.success('Successfully mounted organization and sub-organization folders') } else { - INotification.error('Failed to get user\'s shared workspaces '); + INotification.error('Failed to get user\'s Che orgs'); } } else { - INotification.error('Failed to get user\'s shared workspaces '); + INotification.error('Failed to get user\'s Che orgs'); } }); }