Skip to content

Commit d3cac04

Browse files
committed
update mount function to allow location parameter
1 parent 72099a2 commit d3cac04

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

jupyter_drives/manager.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,17 @@ async def list_drives(self):
303303
}
304304
return response
305305

306-
async def mount_drive(self, drive_name, provider):
306+
async def mount_drive(self, drive_name, provider, location=''):
307307
"""Mount a drive.
308308
309309
Args:
310310
drive_name: name of drive to mount
311311
"""
312312
try:
313313
if provider == 's3':
314-
if drive_name in self._external_drives and self._external_drives[drive_name]["is_public"] is False:
314+
if location:
315+
region = location
316+
elif drive_name in self._external_drives and self._external_drives[drive_name]["is_public"] is False:
315317
region = self._external_drives[drive_name]["location"]
316318
else:
317319
region = await self._get_drive_location(drive_name)

src/plugins/drivelistmanager.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ export function DriveListManagerComponent({ model }: IProps) {
212212
const onAddedPublicDrive = async () => {
213213
// Check if user has access to drive.
214214
const result = await mountDrive(publicDrive, {
215-
provider: 's3'
215+
provider: 's3',
216+
location: isPublic ? '' : driveRegion
216217
});
217218
if (result && result.error) {
218219
// Show error in case of failure.

src/requests.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,12 @@ export async function getDrivesList() {
6767
*/
6868
export async function mountDrive(
6969
driveName: string,
70-
options: { provider: string }
70+
options: { provider: string; location?: string }
7171
) {
7272
const body: ReadonlyJSONObject = {
7373
drive_name: driveName,
74-
provider: options.provider
74+
provider: options.provider,
75+
location: options.location ?? ''
7576
};
7677
try {
7778
await requestAPI<any>('drives', 'POST', body);

0 commit comments

Comments
 (0)