apps: typo caused invalid backupId
This commit is contained in:
10
src/apps.js
10
src/apps.js
@@ -2860,12 +2860,12 @@ async function restoreApps(apps, options, auditSource) {
|
||||
apps = apps.filter(app => app.installationState !== exports.ISTATE_PENDING_RESTORE); // safeguard against tasks being created non-stop if we crash on startup
|
||||
|
||||
for (const app of apps) {
|
||||
const [error, result] = await safe(backups.getByIdentifierAndStatePaged(app.id, backups.BACKUP_STATE_NORMAL, 1, 1));
|
||||
const [error, results] = await safe(backups.getByIdentifierAndStatePaged(app.id, backups.BACKUP_STATE_NORMAL, 1, 1));
|
||||
let installationState, restoreConfig;
|
||||
if (!error && result.length) {
|
||||
if (!error && results.length) {
|
||||
installationState = exports.ISTATE_PENDING_RESTORE;
|
||||
// intentionally ignore options.backupSite since the site may not have all the apps
|
||||
restoreConfig = { backupId: result.id };
|
||||
restoreConfig = { backupId: results[0].id };
|
||||
} else {
|
||||
installationState = exports.ISTATE_PENDING_INSTALL;
|
||||
restoreConfig = null;
|
||||
@@ -2878,11 +2878,11 @@ async function restoreApps(apps, options, auditSource) {
|
||||
requireNullTaskId: false // ignore existing stale taskId
|
||||
};
|
||||
|
||||
debug(`restoreApps: marking ${app.fqdn} for restore using restore config ${JSON.stringify(restoreConfig)}`);
|
||||
debug(`restoreApps: marking ${app.fqdn} as ${installationState} using restore config ${JSON.stringify(restoreConfig)}`);
|
||||
|
||||
const [addTaskError, taskId] = await safe(addTask(app.id, installationState, task, auditSource));
|
||||
if (addTaskError) debug(`restoreApps: error marking ${app.fqdn} for restore: ${JSON.stringify(addTaskError)}`);
|
||||
else debug(`restoreApps: marked ${app.id} for restore with taskId ${taskId}`);
|
||||
else debug(`restoreApps: marked ${app.id} as ${installationState} with taskId ${taskId}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user