Rebuild sftp addon after an apptask

This commit is contained in:
Johannes Zellner
2020-08-19 18:23:44 +02:00
parent 6a781c62ec
commit ec5129d25b
2 changed files with 7 additions and 19 deletions

View File

@@ -43,7 +43,6 @@ var addons = require('./addons.js'),
rimraf = require('rimraf'),
safe = require('safetydance'),
settings = require('./settings.js'),
sftp = require('./sftp.js'),
shell = require('./shell.js'),
superagent = require('superagent'),
sysinfo = require('./sysinfo.js'),
@@ -578,9 +577,6 @@ function install(app, args, progressCallback, callback) {
startApp.bind(null, app),
progressCallback.bind(null, { percent: 80, message: 'Configuring file manager' }),
sftp.rebuild.bind(null, {}),
progressCallback.bind(null, { percent: 85, message: 'Waiting for DNS propagation' }),
exports._waitForDnsPropagation.bind(null, app),
@@ -743,11 +739,7 @@ function migrateDataDir(app, args, progressCallback, callback) {
return updateApp(app, { installationState: apps.ISTATE_ERROR, error: makeTaskError(error, app) }, callback.bind(null, error));
}
// We do this after the app has the new data commited to the database
sftp.rebuild({}, function (error) {
if (error) debug('migrateDataDir: failed to rebuild sftp addon:', error);
callback();
});
callback();
});
}
@@ -782,9 +774,6 @@ function configure(app, args, progressCallback, callback) {
startApp.bind(null, app),
progressCallback.bind(null, { percent: 80, message: 'Configuring file manager' }),
sftp.rebuild.bind(null, {}),
progressCallback.bind(null, { percent: 90, message: 'Configuring reverse proxy' }),
configureReverseProxy.bind(null, app),
@@ -887,9 +876,6 @@ function update(app, args, progressCallback, callback) {
startApp.bind(null, app),
progressCallback.bind(null, { percent: 80, message: 'Configuring file manager' }),
sftp.rebuild.bind(null, {}),
progressCallback.bind(null, { percent: 100, message: 'Done' }),
updateApp.bind(null, app, { installationState: apps.ISTATE_INSTALLED, error: null, health: null, updateTime: new Date() })
], function seriesDone(error) {
@@ -993,10 +979,6 @@ function uninstall(app, args, progressCallback, callback) {
addons.teardownAddons.bind(null, app, app.manifest.addons),
progressCallback.bind(null, { percent: 40, message: 'Cleanup file manager' }),
function (callback) {
if (!app.dataDir) return callback();
sftp.rebuild({ ignoredApps: [ app.id ] }, callback);
},
progressCallback.bind(null, { percent: 50, message: 'Deleting app data directory' }),
deleteAppDir.bind(null, app, { removeDirectory: true }),

View File

@@ -12,6 +12,7 @@ let assert = require('assert'),
safe = require('safetydance'),
path = require('path'),
paths = require('./paths.js'),
sftp = require('./sftp.js'),
tasks = require('./tasks.js');
let gActiveTasks = { }; // indexed by app id
@@ -74,6 +75,11 @@ function scheduleTask(appId, taskId, callback) {
delete gActiveTasks[appId];
locker.unlock(locker.OP_APPTASK); // unlock event will trigger next task
// post app task hooks
sftp.rebuild({}, function (error) {
if (error) console.error('Unable to rebuild sftp:', error);
});
});
}