backups: fix restore code path after backup id changes

This commit is contained in:
Girish Ramakrishnan
2022-04-05 09:28:30 -07:00
parent b4b999bd74
commit 709d4041b2
7 changed files with 38 additions and 34 deletions
+4 -4
View File
@@ -153,16 +153,16 @@ async function activate(username, password, email, displayName, ip, auditSource)
};
}
async function restoreTask(backupConfig, backupId, sysinfoConfig, options, auditSource) {
async function restoreTask(backupConfig, remotePath, sysinfoConfig, options, auditSource) {
assert.strictEqual(typeof backupConfig, 'object');
assert.strictEqual(typeof backupId, 'string');
assert.strictEqual(typeof remotePath, 'string');
assert.strictEqual(typeof sysinfoConfig, 'object');
assert.strictEqual(typeof options, 'object');
assert.strictEqual(typeof auditSource, 'object');
try {
setProgress('restore', 'Downloading box backup');
await backuptask.restore(backupConfig, backupId, (progress) => setProgress('restore', progress.message));
await backuptask.restore(backupConfig, remotePath, (progress) => setProgress('restore', progress.message));
setProgress('restore', 'Downloading mail backup');
const mailBackups = await backups.getByIdentifierAndStatePaged(backups.BACKUP_IDENTIFIER_MAIL, backups.BACKUP_STATE_NORMAL, 1, 1);
@@ -178,7 +178,7 @@ async function restoreTask(backupConfig, backupId, sysinfoConfig, options, audit
if (!options.skipDnsSetup) await cloudron.setupDnsAndCert(constants.DASHBOARD_LOCATION, dashboardDomain, auditSource, (progress) => setProgress('restore', progress.message));
await cloudron.setDashboardDomain(dashboardDomain, auditSource);
await settings.setBackupCredentials(backupConfig); // update just the credentials and not the policy and flags
await eventlog.add(eventlog.ACTION_RESTORE, auditSource, { backupId });
await eventlog.add(eventlog.ACTION_RESTORE, auditSource, { remotePath });
setImmediate(() => safe(cloudron.onActivated(options), { debug }));
} catch (error) {