ensure we have atleast 1GB before making an update
This commit is contained in:
@@ -71,18 +71,14 @@ async function checkPreconditions(apiConfig, dataLayout, callback) {
|
||||
for (let localPath of dataLayout.localPaths()) {
|
||||
debug(`checkPreconditions: getting disk usage of ${localPath}`);
|
||||
let result = safe.child_process.execSync(`du -Dsb ${localPath}`, { encoding: 'utf8' });
|
||||
if (!result) return callback(new BoxError(BoxError.FS_ERROR, safe.error));
|
||||
if (!result) return callback(new BoxError(BoxError.FS_ERROR, `du error: ${safe.error.message}`));
|
||||
used += parseInt(result, 10);
|
||||
}
|
||||
|
||||
debug(`checkPreconditions: ${used} bytes`);
|
||||
|
||||
let result;
|
||||
try {
|
||||
result = await df.file(getBackupPath(apiConfig));
|
||||
} catch(error) {
|
||||
return callback(new BoxError(BoxError.FS_ERROR, error));
|
||||
}
|
||||
const [error, result] = await safe(df.file(getBackupPath(apiConfig)));
|
||||
if (error) return callback(new BoxError(BoxError.FS_ERROR, `Error when checking for disk space: ${error.message}`));
|
||||
|
||||
// Check filesystem is mounted so we don't write into the actual folder on disk
|
||||
if (apiConfig.provider === PROVIDER_SSHFS || apiConfig.provider === PROVIDER_CIFS || apiConfig.provider === PROVIDER_NFS || apiConfig.provider === PROVIDER_EXT4) {
|
||||
|
||||
Reference in New Issue
Block a user