repair can always be called

this is because sometimes cloudron thinks there is no error, but there is
This commit is contained in:
Girish Ramakrishnan
2019-10-03 11:29:58 -07:00
parent 0542ab16d4
commit d5ec599dd1

View File

@@ -1397,9 +1397,8 @@ function repair(appId, data, auditSource, callback) {
get(appId, function (error, app) {
if (error) return callback(error);
if (app.installationState !== exports.ISTATE_ERROR) return new AppsError(AppsError.BAD_STATE, 'Only allowed in error state');
const appError = app.error || {};
const appError = app.error || {}; // repair can always be called
const newState = appError.installationState ? appError.installationState : exports.ISTATE_PENDING_CONFIGURE;
debug(`Repairing app with error: ${JSON.stringify(error)} and state: ${newState}`);
@@ -1413,7 +1412,7 @@ function repair(appId, data, auditSource, callback) {
if ('overwriteDns' in data) args.overwriteDns = data.overwriteDns;
// create a new task instead of updating the old one, since it helps tracking
addTask(appId, newState, { args, values, requiredState: exports.ISTATE_ERROR }, function (error, result) {
addTask(appId, newState, { args, values, requiredState: null }, function (error, result) {
if (error) return callback(error);
eventlog.add(eventlog.ACTION_APP_REPAIR, auditSource, { taskId: result.taskId, app, newState });