diff --git a/src/backups.js b/src/backups.js index 870a1625b..39b25a602 100644 --- a/src/backups.js +++ b/src/backups.js @@ -67,12 +67,6 @@ const COLLECTD_CONFIG_EJS = fs.readFileSync(__dirname + '/collectd/cloudron-back const BACKUPS_FIELDS = [ 'id', 'remotePath', 'label', 'identifier', 'creationTime', 'packageVersion', 'type', 'dependsOnJson', 'state', 'manifestJson', 'format', 'preserveSecs', 'encryptionVersion' ]; -// helper until all storage providers have been ported -function maybePromisify(func) { - if (util.types.isAsyncFunction(func)) return func; - return util.promisify(func); -} - function postProcess(result) { assert.strictEqual(typeof result, 'object'); @@ -385,5 +379,5 @@ async function remount(auditSource) { const func = storage.api(backupConfig.provider); if (!func) throw new BoxError(BoxError.BAD_FIELD, 'unknown storage provider'); - await maybePromisify(storage.api(backupConfig.provider).remount)(backupConfig); + await storage.api(backupConfig.provider).remount(backupConfig); } diff --git a/src/storage/filesystem.js b/src/storage/filesystem.js index 3d25de419..e41faee16 100644 --- a/src/storage/filesystem.js +++ b/src/storage/filesystem.js @@ -281,7 +281,7 @@ function validateBackupTarget(folder) { async function remount(apiConfig) { assert.strictEqual(typeof apiConfig, 'object'); - if (apiConfig.provider === PROVIDER_FILESYSTEM || apiConfig.provider === PROVIDER_MOUNTPOINT) throw new BoxError(BoxError.NOT_SUPPORTED); + if (apiConfig.provider === PROVIDER_FILESYSTEM || apiConfig.provider === PROVIDER_MOUNTPOINT) return; await mounts.remount(mounts.mountObjectFromBackupConfig(apiConfig)); } diff --git a/src/storage/gcs.js b/src/storage/gcs.js index d66cc1773..9715f84dc 100644 --- a/src/storage/gcs.js +++ b/src/storage/gcs.js @@ -262,11 +262,8 @@ function removeDir(apiConfig, pathPrefix) { return events; } -function remount(apiConfig, callback) { +async function remount(apiConfig) { assert.strictEqual(typeof apiConfig, 'object'); - assert.strictEqual(typeof callback, 'function'); - - return callback(new BoxError(BoxError.NOT_SUPPORTED)); } function testConfig(apiConfig, callback) { diff --git a/src/storage/interface.js b/src/storage/interface.js index 8bb9949d0..4b5d5df36 100644 --- a/src/storage/interface.js +++ b/src/storage/interface.js @@ -140,13 +140,12 @@ function removeDir(apiConfig, pathPrefix) { return events; } -function remount(apiConfig, callback) { +async function remount(apiConfig) { assert.strictEqual(typeof apiConfig, 'object'); - assert.strictEqual(typeof callback, 'function'); // Result: none - callback(new BoxError(BoxError.NOT_IMPLEMENTED, 'remount is not implemented')); + throw new BoxError(BoxError.NOT_IMPLEMENTED, 'remount is not implemented'); } function testConfig(apiConfig, callback) { diff --git a/src/storage/noop.js b/src/storage/noop.js index 772d2b1d5..3bd988a3f 100644 --- a/src/storage/noop.js +++ b/src/storage/noop.js @@ -126,11 +126,8 @@ function removeDir(apiConfig, pathPrefix) { return events; } -function remount(apiConfig, callback) { +async function remount(apiConfig) { assert.strictEqual(typeof apiConfig, 'object'); - assert.strictEqual(typeof callback, 'function'); - - callback(null); } function testConfig(apiConfig, callback) { diff --git a/src/storage/s3.js b/src/storage/s3.js index 7f953c0be..79f5df958 100644 --- a/src/storage/s3.js +++ b/src/storage/s3.js @@ -457,11 +457,8 @@ function removeDir(apiConfig, pathPrefix) { return events; } -function remount(apiConfig, callback) { +async function remount(apiConfig) { assert.strictEqual(typeof apiConfig, 'object'); - assert.strictEqual(typeof callback, 'function'); - - return callback(new BoxError(BoxError.NOT_SUPPORTED)); } function testConfig(apiConfig, callback) {