Do not configure/restore errored apps automatically
This commit is contained in:
10
src/apps.js
10
src/apps.js
@@ -634,7 +634,6 @@ function scheduleTask(appId, args, values, callback) {
|
||||
tasks.add(tasks.TASK_APP, [ appId, args ], function (error, taskId) {
|
||||
if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error));
|
||||
|
||||
values.error = null;
|
||||
values.taskId = taskId;
|
||||
|
||||
appdb.setTask(appId, values, function (error) {
|
||||
@@ -1758,6 +1757,7 @@ function restoreInstalledApps(callback) {
|
||||
|
||||
getAll(function (error, apps) {
|
||||
if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error));
|
||||
apps = apps.filter(app => app.installationState !== exports.ISTATE_ERROR); // remove errored apps. let them be 'repaired' by hand
|
||||
|
||||
async.map(apps, function (app, iteratorDone) {
|
||||
backups.getByAppIdPaged(1, 1, app.id, function (error, results) {
|
||||
@@ -1765,7 +1765,7 @@ function restoreInstalledApps(callback) {
|
||||
|
||||
debug(`marking ${app.fqdn} for restore using restore config ${JSON.stringify(restoreConfig)}`);
|
||||
|
||||
appdb.update(app.id, { taskId: null }, function (error) { // clear any stale taskId
|
||||
appdb.update(app.id, { taskId: null, error: null }, function (error) { // clear any stale taskId
|
||||
if (error) debug(`Error marking ${app.fqdn} for restore: ${JSON.stringify(error)}`);
|
||||
|
||||
scheduleTask(app.id, { restoreConfig, overwriteDns: true }, { installationState: exports.ISTATE_PENDING_RESTORE }, () => iteratorDone()); // always succeed
|
||||
@@ -1780,14 +1780,16 @@ function configureInstalledApps(callback) {
|
||||
|
||||
getAll(function (error, apps) {
|
||||
if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error));
|
||||
apps = apps.filter(app => app.installationState !== exports.ISTATE_ERROR); // remove errored apps. let them be 'repaired' by hand
|
||||
|
||||
async.map(apps, function (app, iteratorDone) {
|
||||
debug(`marking ${app.fqdn} for reconfigure`);
|
||||
|
||||
appdb.update(app.id, { taskId: null }, function (error) { // clear any stale taskId
|
||||
appdb.update(app.id, { taskId: null, error: null }, function (error) { // clear any stale taskId
|
||||
if (error) debug(`Error marking ${app.fqdn} for reconfigure: ${JSON.stringify(error)}`);
|
||||
|
||||
scheduleTask(app.id, { oldConfig: app }, { installationState: exports.ISTATE_PENDING_CONFIGURE }, () => iteratorDone()); // always succeed
|
||||
const oldConfig = _.pick(app, 'location', 'domain', 'fqdn', 'alternateDomains', 'portBindings');
|
||||
scheduleTask(app.id, { oldConfig }, { installationState: exports.ISTATE_PENDING_CONFIGURE }, () => iteratorDone()); // always succeed
|
||||
});
|
||||
}, callback);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user