If app.dataDir is set, first unmount from sftp before deleting on uninstall
This commit is contained in:
13
src/sftp.js
13
src/sftp.js
@@ -19,12 +19,16 @@ function startSftp(existingInfra, callback) {
|
||||
|
||||
if (existingInfra.version === infra.version && infra.images.sftp.tag === existingInfra.images.sftp.tag) return callback();
|
||||
|
||||
rebuild(callback);
|
||||
rebuild({}, callback);
|
||||
}
|
||||
|
||||
function rebuild(callback) {
|
||||
// options only supports ignoredDataDirs = [ pathString ]
|
||||
function rebuild(options, callback) {
|
||||
assert.strictEqual(typeof options, 'object');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
if (options.ignoredDataDirs) assert(Array.isArray(options.ignoredDataDirs), 'Expecting ignoredDataDirs to be an array');
|
||||
|
||||
debug('rebuilding container');
|
||||
|
||||
const tag = infra.images.sftp.tag;
|
||||
@@ -37,6 +41,11 @@ function rebuild(callback) {
|
||||
result.forEach(function (app) {
|
||||
if (!app.dataDir) return;
|
||||
|
||||
if (options.ignoredDataDirs && options.ignoredDataDirs.indexOf(app.dataDir) !== -1) {
|
||||
debug(`Ignoring dataDir ${app.dataDir}`);
|
||||
return;
|
||||
}
|
||||
|
||||
dataDirs.push({
|
||||
hostDir: app.dataDir,
|
||||
// /data is required since this is where the localstorage data would be in APPS_DATA_DIR
|
||||
|
||||
Reference in New Issue
Block a user