backups: move mount status to separate route
This commit is contained in:
@@ -27,6 +27,7 @@ exports = module.exports = {
|
||||
testProviderConfig,
|
||||
|
||||
remount,
|
||||
getMountStatus,
|
||||
|
||||
BACKUP_IDENTIFIER_BOX: 'box',
|
||||
BACKUP_IDENTIFIER_MAIL: 'mail',
|
||||
@@ -50,6 +51,7 @@ const assert = require('assert'),
|
||||
eventlog = require('./eventlog.js'),
|
||||
hat = require('./hat.js'),
|
||||
locker = require('./locker.js'),
|
||||
mounts = require('./mounts.js'),
|
||||
path = require('path'),
|
||||
paths = require('./paths.js'),
|
||||
safe = require('safetydance'),
|
||||
@@ -361,3 +363,18 @@ async function remount(auditSource) {
|
||||
|
||||
await storage.api(backupConfig.provider).remount(backupConfig);
|
||||
}
|
||||
|
||||
async function getMountStatus() {
|
||||
const backupConfig = await settings.getBackupConfig();
|
||||
|
||||
let hostPath;
|
||||
if (mounts.isManagedProvider(backupConfig.provider)) {
|
||||
hostPath = paths.MANAGED_BACKUP_MOUNT_DIR;
|
||||
} else if (backupConfig.provider === 'mountpoint') {
|
||||
hostPath = backupConfig.mountPoint;
|
||||
} else if (backupConfig.provider === 'filesystem') {
|
||||
hostPath = backupConfig.backupFolder;
|
||||
}
|
||||
|
||||
return await mounts.getStatus(backupConfig.provider, hostPath); // { state, message }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user