mount: if unmount failed, do not proceed
This commit is contained in:
@@ -158,7 +158,8 @@ async function tryAddMount(volume, options) {
|
||||
if (!safe.fs.writeFileSync(keyFilePath, `${volume.mountOptions.privateKey}\n`, { mode: 0o600 })) throw new BoxError(BoxError.FS_ERROR, safe.error);
|
||||
}
|
||||
|
||||
await safe(shell.promises.sudo('addMount', [ ADD_MOUNT_CMD, renderMountFile(volume), options.timeout ], {}));
|
||||
const [error] = await safe(shell.promises.sudo('addMount', [ ADD_MOUNT_CMD, renderMountFile(volume), options.timeout ], {}));
|
||||
if (error && error.code === 2) throw new BoxError(BoxError.MOUNT_ERROR, 'Failed to unmount existing mount'); // at this point, the old mount config is still there
|
||||
|
||||
const status = await getStatus(volume.mountType, volume.hostPath);
|
||||
if (status.state !== 'active') { // cleanup
|
||||
|
||||
Reference in New Issue
Block a user