If app.dataDir is set, first unmount from sftp before deleting on uninstall

This commit is contained in:
Johannes Zellner
2020-07-29 15:02:30 +02:00
parent f511a610b5
commit e1718c4e8d
2 changed files with 22 additions and 7 deletions

View File

@@ -743,7 +743,7 @@ function migrateDataDir(app, args, progressCallback, callback) {
}
// We do this after the app has the new data commited to the database
sftp.rebuild(function (error) {
sftp.rebuild({}, function (error) {
if (error) console.error('Failed to rebuild sftp addon:', error);
callback();
});
@@ -984,16 +984,22 @@ function uninstall(app, args, progressCallback, callback) {
progressCallback.bind(null, { percent: 30, message: 'Teardown addons' }),
addons.teardownAddons.bind(null, app, app.manifest.addons),
progressCallback.bind(null, { percent: 40, message: 'Deleting app data directory' }),
progressCallback.bind(null, { percent: 40, message: 'Remove sftp addon binding' }),
function (callback) {
if (!app.dataDir) return callback();
sftp.rebuild({ ignoredDataDirs: [ app.dataDir ] }, callback);
},
progressCallback.bind(null, { percent: 50, message: 'Deleting app data directory' }),
deleteAppDir.bind(null, app, { removeDirectory: true }),
progressCallback.bind(null, { percent: 50, message: 'Deleting image' }),
progressCallback.bind(null, { percent: 60, message: 'Deleting image' }),
docker.deleteImage.bind(null, app.manifest),
progressCallback.bind(null, { percent: 60, message: 'Unregistering domains' }),
progressCallback.bind(null, { percent: 70, message: 'Unregistering domains' }),
unregisterSubdomains.bind(null, app, [ { subdomain: app.location, domain: app.domain } ].concat(app.alternateDomains)),
progressCallback.bind(null, { percent: 70, message: 'Cleanup icon' }),
progressCallback.bind(null, { percent: 80, message: 'Cleanup icon' }),
removeIcon.bind(null, app),
progressCallback.bind(null, { percent: 90, message: 'Cleanup logs' }),