restore: fix usage of backupId

This commit is contained in:
Girish Ramakrishnan
2022-04-13 21:23:12 -05:00
parent 5870f949a3
commit b0a09a8a00

View File

@@ -167,7 +167,7 @@ async function restoreTask(backupConfig, remotePath, sysinfoConfig, options, aud
setProgress('restore', 'Downloading mail backup');
const mailBackups = await backups.getByIdentifierAndStatePaged(backups.BACKUP_IDENTIFIER_MAIL, backups.BACKUP_STATE_NORMAL, 1, 1);
if (mailBackups.length === 0) throw new BoxError(BoxError.NOT_FOUND, 'mail backup not found');
const mailRestoreConfig = { backupConfig, backupId: mailBackups[0].id, backupFormat: mailBackups[0].format };
const mailRestoreConfig = { backupConfig, remotePath: mailBackups[0].remotePath, backupFormat: mailBackups[0].format };
await backuptask.downloadMail(mailRestoreConfig, (progress) => setProgress('restore', progress.message));
await ensureDhparams();
@@ -187,9 +187,9 @@ async function restoreTask(backupConfig, remotePath, sysinfoConfig, options, aud
gProvisionStatus.restore.active = false;
}
async function restore(backupConfig, backupId, version, sysinfoConfig, options, auditSource) {
async function restore(backupConfig, remotePath, version, sysinfoConfig, options, auditSource) {
assert.strictEqual(typeof backupConfig, 'object');
assert.strictEqual(typeof backupId, 'string');
assert.strictEqual(typeof remotePath, 'string');
assert.strictEqual(typeof version, 'string');
assert.strictEqual(typeof sysinfoConfig, 'object');
assert.strictEqual(typeof options, 'object');
@@ -233,7 +233,7 @@ async function restore(backupConfig, backupId, version, sysinfoConfig, options,
error = await sysinfo.testIPv4Config(sysinfoConfig);
if (error) throw error;
safe(restoreTask(backupConfig, backupId, sysinfoConfig, options, auditSource), { debug }); // now that args are validated run the task in the background
safe(restoreTask(backupConfig, remotePath, sysinfoConfig, options, auditSource), { debug }); // now that args are validated run the task in the background
} catch (error) {
gProvisionStatus.restore.active = false;
gProvisionStatus.restore.errorMessage = error ? error.message : '';