Rename backup label to name and separate backup listing into new view
This commit is contained in:
@@ -346,24 +346,27 @@ async function verifyConfig({ id, provider, config }) {
|
||||
}
|
||||
}
|
||||
|
||||
const tmp = _.pick(config, ['noHardlinks', 'chown', 'preserveAttributes', 'backupDir', 'prefix', 'mountOptions', 'mountPoint']);
|
||||
const newConfig = { _provider: provider, _managedMountPath: managedMountPath, ...tmp };
|
||||
const fullPath = getRootPath(newConfig);
|
||||
const newConfig = _.pick(config, ['noHardlinks', 'chown', 'preserveAttributes', 'backupDir', 'prefix', 'mountOptions', 'mountPoint']);
|
||||
newConfig._provider = provider;
|
||||
|
||||
const fullPath = getRootPath({ ...newConfig, _managedMountPath: `${managedMountPath}-validation` });
|
||||
if (!safe.fs.mkdirSync(path.join(fullPath, 'snapshot'), { recursive: true }) && safe.error.code !== 'EEXIST') {
|
||||
if (safe.error && safe.error.code === 'EACCES') throw new BoxError(BoxError.BAD_FIELD, `Access denied. Create ${fullPath}/snapshot and run "chown yellowtent:yellowtent ${fullPath}" on the server`);
|
||||
throw new BoxError(BoxError.BAD_FIELD, safe.error.message);
|
||||
}
|
||||
|
||||
if (!safe.fs.writeFileSync(path.join(fullPath, 'cloudron-testfile'), 'testcontent')) {
|
||||
if (!safe.fs.writeFileSync(path.join(fullPath, 'snapshot/cloudron-testfile'), 'testcontent')) {
|
||||
throw new BoxError(BoxError.BAD_FIELD, `Unable to create test file as 'yellowtent' user in ${fullPath}: ${safe.error.message}. Check dir/mount permissions`);
|
||||
}
|
||||
}
|
||||
|
||||
if (!safe.fs.unlinkSync(path.join(fullPath, 'cloudron-testfile'))) {
|
||||
if (!safe.fs.unlinkSync(path.join(fullPath, 'snapshot/cloudron-testfile'))) {
|
||||
throw new BoxError(BoxError.BAD_FIELD, `Unable to remove test file as 'yellowtent' user in ${fullPath}: ${safe.error.message}. Check dir/mount permissions`);
|
||||
}
|
||||
|
||||
if (mounts.isManagedProvider(provider)) await mounts.removeMount({ hostPath: `${managedMountPath}-validation`, mountType: provider, mountOptions: config.mountOptions });
|
||||
if (mounts.isManagedProvider(provider)) {
|
||||
await mounts.removeMount({ hostPath: `${managedMountPath}-validation`, mountType: provider, mountOptions: config.mountOptions });
|
||||
newConfig._managedMountPath = managedMountPath;
|
||||
}
|
||||
|
||||
return newConfig;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user