backups: fix various mount issues

This commit is contained in:
Girish Ramakrishnan
2021-05-17 15:58:38 -07:00
parent 599b604dca
commit 14bb928d41
5 changed files with 45 additions and 38 deletions
+4 -3
View File
@@ -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';
}