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
-18
View File
@@ -43,7 +43,6 @@ var addons = require('./addons.js'),
rimraf = require('rimraf'), rimraf = require('rimraf'),
safe = require('safetydance'), safe = require('safetydance'),
settings = require('./settings.js'), settings = require('./settings.js'),
sftp = require('./sftp.js'),
shell = require('./shell.js'), shell = require('./shell.js'),
superagent = require('superagent'), superagent = require('superagent'),
sysinfo = require('./sysinfo.js'), sysinfo = require('./sysinfo.js'),
@@ -578,9 +577,6 @@ function install(app, args, progressCallback, callback) {
startApp.bind(null, app), 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' }), progressCallback.bind(null, { percent: 85, message: 'Waiting for DNS propagation' }),
exports._waitForDnsPropagation.bind(null, app), exports._waitForDnsPropagation.bind(null, app),
@@ -743,12 +739,8 @@ function migrateDataDir(app, args, progressCallback, callback) {
return updateApp(app, { installationState: apps.ISTATE_ERROR, error: makeTaskError(error, app) }, callback.bind(null, error)); 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();
}); });
});
} }
// configure is called for an infra update and repair to re-create container, reverseproxy config. it's all "local" // configure is called for an infra update and repair to re-create container, reverseproxy config. it's all "local"
@@ -782,9 +774,6 @@ function configure(app, args, progressCallback, callback) {
startApp.bind(null, app), 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' }), progressCallback.bind(null, { percent: 90, message: 'Configuring reverse proxy' }),
configureReverseProxy.bind(null, app), configureReverseProxy.bind(null, app),
@@ -887,9 +876,6 @@ function update(app, args, progressCallback, callback) {
startApp.bind(null, app), startApp.bind(null, app),
progressCallback.bind(null, { percent: 80, message: 'Configuring file manager' }),
sftp.rebuild.bind(null, {}),
progressCallback.bind(null, { percent: 100, message: 'Done' }), progressCallback.bind(null, { percent: 100, message: 'Done' }),
updateApp.bind(null, app, { installationState: apps.ISTATE_INSTALLED, error: null, health: null, updateTime: new Date() }) updateApp.bind(null, app, { installationState: apps.ISTATE_INSTALLED, error: null, health: null, updateTime: new Date() })
], function seriesDone(error) { ], function seriesDone(error) {
@@ -993,10 +979,6 @@ function uninstall(app, args, progressCallback, callback) {
addons.teardownAddons.bind(null, app, app.manifest.addons), addons.teardownAddons.bind(null, app, app.manifest.addons),
progressCallback.bind(null, { percent: 40, message: 'Cleanup file manager' }), 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' }), progressCallback.bind(null, { percent: 50, message: 'Deleting app data directory' }),
deleteAppDir.bind(null, app, { removeDirectory: true }), deleteAppDir.bind(null, app, { removeDirectory: true }),
+6
View File
@@ -12,6 +12,7 @@ let assert = require('assert'),
safe = require('safetydance'), safe = require('safetydance'),
path = require('path'), path = require('path'),
paths = require('./paths.js'), paths = require('./paths.js'),
sftp = require('./sftp.js'),
tasks = require('./tasks.js'); tasks = require('./tasks.js');
let gActiveTasks = { }; // indexed by app id let gActiveTasks = { }; // indexed by app id
@@ -74,6 +75,11 @@ function scheduleTask(appId, taskId, callback) {
delete gActiveTasks[appId]; delete gActiveTasks[appId];
locker.unlock(locker.OP_APPTASK); // unlock event will trigger next task 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);
});
}); });
} }