diff --git a/src/apps.js b/src/apps.js index 9db87a7d8..073c87391 100644 --- a/src/apps.js +++ b/src/apps.js @@ -2864,7 +2864,7 @@ async function restoreApps(apps, options, auditSource) { let installationState, restoreConfig; if (!error && results.length) { installationState = exports.ISTATE_PENDING_RESTORE; - // intentionally ignore options.backupSite since the site may not have all the apps + // intentionally ignore any backupSite provided during restore by the user because the site may not have all the apps restoreConfig = { backupId: results[0].id }; } else { installationState = exports.ISTATE_PENDING_INSTALL; diff --git a/src/platform.js b/src/platform.js index 381a0ee3f..5a23eda4a 100644 --- a/src/platform.js +++ b/src/platform.js @@ -77,7 +77,7 @@ async function removeAllContainers() { async function markApps(existingInfra, restoreOptions) { assert.strictEqual(typeof existingInfra, 'object'); - assert.strictEqual(typeof restoreOptions, 'object'); // { backupSite, skipDnsSetup } + assert.strictEqual(typeof restoreOptions, 'object'); // { skipDnsSetup } if (existingInfra.version === 'none') { // cloudron is being restored from backup debug('markApps: restoring apps'); @@ -114,7 +114,7 @@ async function onInfraReady(infraChanged) { } async function startInfra(restoreOptions) { - assert.strictEqual(typeof restoreOptions, 'object'); // { backupSite, skipDnsSetup } + assert.strictEqual(typeof restoreOptions, 'object'); // { skipDnsSetup } if (constants.TEST && !process.env.TEST_CREATE_INFRA) return; @@ -201,7 +201,7 @@ async function uninitialize() { } async function onActivated(restoreOptions) { - assert.strictEqual(typeof restoreOptions, 'object'); // { backupSite, skipDnsSetup } + assert.strictEqual(typeof restoreOptions, 'object'); // { skipDnsSetup } debug('onActivated: starting post activation services'); diff --git a/src/provision.js b/src/provision.js index 111f5c920..e2c04f4f4 100644 --- a/src/provision.js +++ b/src/provision.js @@ -163,7 +163,7 @@ async function activate(username, password, email, displayName, ip, auditSource) await eventlog.add(eventlog.ACTION_ACTIVATE, auditSource, {}); - setImmediate(() => safe(platform.onActivated({ skipDnsSetup: false }), { debug })); + safe(platform.onActivated({ skipDnsSetup: false }), { debug }); // background return { userId: ownerId, @@ -220,7 +220,9 @@ async function restoreTask(backupSite, remotePath, ipv4Config, ipv6Config, optio await appstore.checkSubscription(); // never throws. worst case, user has to visit the Account view to refresh subscription info - setImmediate(() => safe(platform.onActivated({ backupSite, skipDnsSetup: options.skipDnsSetup }), { debug })); + safe(platform.onActivated({ skipDnsSetup: options.skipDnsSetup }), { debug }); // background + + await backupSites.storageApi(backupSite).teardown(backupSite.config); } catch (error) { debug('restoreTask: error. %o', error); gStatus.restore.errorMessage = error ? error.message : '';