backups: fix various mount issues
This commit is contained in:
+4
-3
@@ -26,7 +26,8 @@ function validateMountOptions(type, options) {
|
||||
assert.strictEqual(typeof options, 'object');
|
||||
|
||||
switch (type) {
|
||||
case 'noop':
|
||||
case 'noop': // volume provider
|
||||
case 'mountpoint': // backup provider
|
||||
return null;
|
||||
case 'cifs':
|
||||
if (typeof options.username !== 'string') return new BoxError(BoxError.BAD_FIELD, 'username is not a string');
|
||||
@@ -92,7 +93,7 @@ async function getStatus(mountType, hostPath) {
|
||||
assert.strictEqual(typeof mountType, 'string');
|
||||
assert.strictEqual(typeof hostPath, 'string');
|
||||
|
||||
if (mountType === 'noop') {
|
||||
if (mountType === 'noop' || mountType === 'mountpoint') { // noop is from volume provider and mountpoint is from backup provider
|
||||
if (safe.child_process.execSync(`mountpoint -q -- ${hostPath}`, { encoding: 'utf8' })) {
|
||||
return { state: 'active', message: 'Mounted' };
|
||||
} else {
|
||||
@@ -112,7 +113,7 @@ async function getStatus(mountType, hostPath) {
|
||||
const idx = rlines.findIndex(l => l.startsWith('mount ') || l.startsWith('mount.'));
|
||||
if (idx !== -1) message = rlines[idx];
|
||||
}
|
||||
if (!message) message = `Could not determine failure reason: ${safe.error.message}`;
|
||||
if (!message) message = `Could not determine failure reason. ${safe.error ? safe.error.message : ''}`;
|
||||
} else {
|
||||
message = 'Mounted';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user