storage: remove getProviderStatus
This commit is contained in:
@@ -279,7 +279,7 @@ async function run(progressCallback) {
|
||||
const { retention } = await backups.getPolicy();
|
||||
debug(`run: retention is ${JSON.stringify(retention)}`);
|
||||
|
||||
const status = await storage.api(backupConfig.provider).getProviderStatus(backupConfig);
|
||||
const status = await backups.getMountStatus();
|
||||
debug(`run: mount point status is ${JSON.stringify(status)}`);
|
||||
if (status.state !== 'active') throw new BoxError(BoxError.MOUNT_ERROR, `Backup endpoint is not mounted: ${status.message}`);
|
||||
|
||||
|
||||
+1
-1
@@ -380,7 +380,7 @@ async function getMountStatus() {
|
||||
} else if (backupConfig.provider === 'filesystem') {
|
||||
hostPath = backupConfig.backupFolder;
|
||||
} else {
|
||||
throw new BoxError(BoxError.BAD_STATE, 'Backup location is not a mount');
|
||||
return { state: 'active' };
|
||||
}
|
||||
|
||||
return await mounts.getStatus(backupConfig.provider, hostPath); // { state, message }
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ async function checkPreconditions(backupConfig, dataLayout) {
|
||||
assert(dataLayout instanceof DataLayout, 'dataLayout must be a DataLayout');
|
||||
|
||||
// check mount status before uploading
|
||||
const status = await storage.api(backupConfig.provider).getProviderStatus(backupConfig);
|
||||
const status = await backups.getMountStatus();
|
||||
debug(`upload: mount point status is ${JSON.stringify(status)}`);
|
||||
if (status.state !== 'active') throw new BoxError(BoxError.MOUNT_ERROR, `Backup endpoint is not active: ${status.message}`);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ host_path="$1"
|
||||
mount_filename=$(systemd-escape -p --suffix=mount "$host_path")
|
||||
mount_file="/etc/systemd/system/${mount_filename}"
|
||||
|
||||
# stop and start will do the reumount
|
||||
# stop and start will do the remount
|
||||
systemctl stop "${mount_filename}"
|
||||
systemctl start "${mount_filename}"
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
exports = module.exports = {
|
||||
getProviderStatus,
|
||||
getAvailableSize,
|
||||
|
||||
upload,
|
||||
@@ -35,23 +34,12 @@ const assert = require('assert'),
|
||||
debug = require('debug')('box:storage/filesystem'),
|
||||
df = require('../df.js'),
|
||||
fs = require('fs'),
|
||||
mounts = require('../mounts.js'),
|
||||
path = require('path'),
|
||||
paths = require('../paths.js'),
|
||||
readdirp = require('readdirp'),
|
||||
safe = require('safetydance'),
|
||||
shell = require('../shell.js');
|
||||
|
||||
async function getProviderStatus(apiConfig) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
|
||||
// Check filesystem is mounted so we don't write into the actual folder on disk
|
||||
if (!mounts.isManagedProvider(apiConfig.provider) && apiConfig.provider !== 'mountpoint') return await mounts.getStatus(apiConfig.provider, apiConfig.backupFolder);
|
||||
|
||||
const hostPath = mounts.isManagedProvider(apiConfig.provider) ? paths.MANAGED_BACKUP_MOUNT_DIR : apiConfig.mountPoint;
|
||||
return await mounts.getStatus(apiConfig.provider, hostPath); // { state, message }
|
||||
}
|
||||
|
||||
// the du call in the function below requires root
|
||||
async function getAvailableSize(apiConfig) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
exports = module.exports = {
|
||||
getProviderStatus,
|
||||
getAvailableSize,
|
||||
|
||||
upload,
|
||||
@@ -61,12 +60,6 @@ function getBucket(apiConfig) {
|
||||
return new GCS(gcsConfig).bucket(apiConfig.bucket);
|
||||
}
|
||||
|
||||
async function getProviderStatus(apiConfig) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
|
||||
return { state: 'active' };
|
||||
}
|
||||
|
||||
async function getAvailableSize(apiConfig) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
// for the other API calls we leave it to the backend to retry. this allows
|
||||
// them to tune the concurrency based on failures/rate limits accordingly
|
||||
exports = module.exports = {
|
||||
getProviderStatus,
|
||||
getAvailableSize,
|
||||
|
||||
upload,
|
||||
@@ -44,12 +43,6 @@ function injectPrivateFields(newConfig, currentConfig) {
|
||||
// in-place injection of tokens and api keys which came in with constants.SECRET_PLACEHOLDER
|
||||
}
|
||||
|
||||
async function getProviderStatus(apiConfig) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
|
||||
return { state: 'active' };
|
||||
}
|
||||
|
||||
async function getAvailableSize(apiConfig) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
exports = module.exports = {
|
||||
getProviderStatus,
|
||||
getAvailableSize,
|
||||
|
||||
upload,
|
||||
@@ -24,12 +23,6 @@ const assert = require('assert'),
|
||||
debug = require('debug')('box:storage/noop'),
|
||||
fs = require('fs');
|
||||
|
||||
async function getProviderStatus(apiConfig) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
|
||||
return { state: 'active' };
|
||||
}
|
||||
|
||||
async function getAvailableSize(apiConfig) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
exports = module.exports = {
|
||||
getProviderStatus,
|
||||
getAvailableSize,
|
||||
|
||||
upload,
|
||||
@@ -92,12 +91,6 @@ function getS3Config(apiConfig) {
|
||||
return credentials;
|
||||
}
|
||||
|
||||
async function getProviderStatus(apiConfig) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
|
||||
return { state: 'active' };
|
||||
}
|
||||
|
||||
async function getAvailableSize(apiConfig) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user