Skip to content

Commit e0d4993

Browse files
committed
implement unmounting drive functionality in backend
1 parent 16b6355 commit e0d4993

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

jupyter_drives/managers/manager.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,23 @@ async def unmount_drive(self, drive_name: str, **kwargs):
156156
Args:
157157
drive_name: name of drive to unmount
158158
"""
159-
print('Drive unmount function called.')
159+
if drive_name in self._content_managers:
160+
self._content_managers.pop(drive_name, None)
161+
response = {
162+
"code": 204,
163+
"message": "Drive successfully unmounted."
164+
}
165+
166+
else:
167+
response = {
168+
"code": 404,
169+
"message": "Drive is not mounted or doesn't exist."}
170+
raise tornado.web.HTTPError(
171+
status_code= httpx.codes.BAD_REQUEST,
172+
reason="Drive is not mounted or doesn't exist.",
173+
)
174+
175+
return response
160176

161177
async def get_contents(self, drive_name, path, **kwargs):
162178
"""Get contents of a file or directory.

0 commit comments

Comments
 (0)