Skip to content

Commit

Permalink
check if drive was configured already before mounting
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisaCG committed Dec 18, 2023
1 parent 0583772 commit c9c12bd
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions jupyter_drives/managers/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,19 @@ async def mount_drive(self, drive_name):
bucket = drive_name
)

self.s3_content_managers[drive_name] = s3_contents_manager
# checking if the drive wasn't mounted already
if self.s3_content_managers[drive_name] is None:
self.s3_content_managers[drive_name] = s3_contents_manager

response = {
"s3_contents_manager": s3_contents_manager,
"code": 201
}
else:
response = {"code": 409, "message": "Drive already mounted."}

response = {
"s3_contents_manager": s3_contents_manager,
"code": 201
}
except Exception as e:
response = {"code": 400}
response = {"code": 400, "message": e}

return response

Expand Down

0 comments on commit c9c12bd

Please sign in to comment.