auditSource: add PLATFORM

This commit is contained in:
Girish Ramakrishnan
2021-11-17 10:33:28 -08:00
parent 5ab2d9da8a
commit 7ffcfc5206
3 changed files with 16 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ exports = module.exports = {
const apps = require('./apps.js'),
assert = require('assert'),
AuditSource = require('./auditsource.js'),
BoxError = require('./boxerror.js'),
debug = require('debug')('box:platform'),
delay = require('delay'),
@@ -81,7 +82,7 @@ async function onPlatformReady(infraChanged) {
if (infraChanged) await safe(pruneInfraImages(), { debug }); // ignore error
await apps.schedulePendingTasks();
await apps.schedulePendingTasks(AuditSource.PLATFORM);
}
async function pruneInfraImages() {
@@ -123,11 +124,11 @@ async function markApps(existingInfra, options) {
if (existingInfra.version === 'none') { // cloudron is being restored from backup
debug('markApps: restoring installed apps');
await apps.restoreInstalledApps(options);
await apps.restoreInstalledApps(options, AuditSource.PLATFORM);
} else if (existingInfra.version !== infra.version) {
debug('markApps: reconfiguring installed apps');
reverseProxy.removeAppConfigs(); // should we change the cert location, nginx will not start
await apps.configureInstalledApps();
await apps.configureInstalledApps(AuditSource.PLATFORM);
} else {
let changedAddons = [];
if (infra.images.mysql.tag !== existingInfra.images.mysql.tag) changedAddons.push('mysql');
@@ -138,7 +139,7 @@ async function markApps(existingInfra, options) {
if (changedAddons.length) {
// restart apps if docker image changes since the IP changes and any "persistent" connections fail
debug(`markApps: changedAddons: ${JSON.stringify(changedAddons)}`);
await apps.restartAppsUsingAddons(changedAddons);
await apps.restartAppsUsingAddons(changedAddons, AuditSource.PLATFORM);
} else {
debug('markApps: apps are already uptodate');
}