sftp: only mount data dirs that exist
when restoring, the platform starts first and the sftp container goes and creates app data dirs with root permission. this prevents the app restore logic from downloading the backup since it expects yellowtent perm
This commit is contained in:
+9
-4
@@ -10,6 +10,7 @@ var apps = require('./apps.js'),
|
||||
async = require('async'),
|
||||
debug = require('debug')('box:sftp'),
|
||||
infra = require('./infra_version.js'),
|
||||
safe = require('safetydance'),
|
||||
shell = require('./shell.js');
|
||||
|
||||
function startSftp(existingInfra, callback) {
|
||||
@@ -45,10 +46,14 @@ function rebuild(options, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
dataDirs.push({
|
||||
hostDir: apps.getDataDir(app, app.dataDir),
|
||||
mountDir: `/app/data/${app.id}`
|
||||
});
|
||||
const hostDir = apps.getDataDir(app, app.dataDir), mountDir = `/app/data/${app.id}`;
|
||||
if (!safe.fs.existsSync(hostDir)) {
|
||||
// do not create host path when cloudron is restoring. this will then create dir with root perms making restore logic fail
|
||||
debug(`Ignoring volume for ${app.id} since it does not exist`);
|
||||
return;
|
||||
}
|
||||
|
||||
dataDirs.push({ hostDir, mountDir });
|
||||
});
|
||||
|
||||
debug('app volume mounts', dataDirs);
|
||||
|
||||
Reference in New Issue
Block a user