Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Revert shared ws mount and remove read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
bsatoriu committed Feb 22, 2021
1 parent 8995e85 commit 8ae4d23
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion show_ssh_info/show_ssh_info/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 [{
Expand All @@ -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)])

5 changes: 1 addition & 4 deletions show_ssh_info/show_ssh_info/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
11 changes: 7 additions & 4 deletions show_ssh_info/src/funcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
});
}
Expand Down

0 comments on commit 8ae4d23

Please sign in to comment.