Add site name for backup events
This commit is contained in:
@@ -318,10 +318,10 @@ function eventlogDetails(eventLog, app = null, appIdContext = '') {
|
||||
return 'Backup ' + data.backupId + ' deleted from archive';
|
||||
|
||||
case ACTION_BACKUP_START:
|
||||
return `Backup started at ${data.siteName}`;
|
||||
return `Backup started at site ${data.siteName}`;
|
||||
|
||||
case ACTION_BACKUP_FINISH:
|
||||
if (!errorMessage) return `Cloudron backup created at site ${data.siteName} . Path(s): ${JSON.stringify(data.result)}`;
|
||||
if (!errorMessage) return `Cloudron backup created at site ${data.siteName}`;
|
||||
else return `Cloudron backup at site ${data.siteName} errored with error: ${errorMessage}`;
|
||||
|
||||
case ACTION_BACKUP_CLEANUP_START:
|
||||
@@ -365,7 +365,7 @@ function eventlogDetails(eventLog, app = null, appIdContext = '') {
|
||||
return 'Cloudron Footer set to ' + data.footer;
|
||||
|
||||
case ACTION_CERTIFICATE_NEW:
|
||||
return 'Certificate install for ' + data.domain + (errorMessage ? ' failed' : ' succeeded');
|
||||
return 'Certificate installation for ' + data.domain + (errorMessage ? ' failed' : ' succeeded');
|
||||
|
||||
case ACTION_CERTIFICATE_RENEWAL:
|
||||
return 'Certificate renewal for ' + data.domain + (errorMessage ? ' failed' : ' succeeded');
|
||||
|
||||
+3
-3
@@ -381,16 +381,16 @@ async function startBackupTask(site, auditSource) {
|
||||
|
||||
const taskId = await tasks.add(`${tasks.TASK_FULL_BACKUP_PREFIX}${site.id}`, [ site.id, { /* options */ } ]);
|
||||
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_START, auditSource, { taskId, siteId: site.id });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_START, auditSource, { taskId, siteId: site.id, siteName: site.name });
|
||||
|
||||
// background
|
||||
tasks.startTask(taskId, { timeout: 24 * 60 * 60 * 1000 /* 24 hours */, nice: 15, memoryLimit, oomScoreAdjust: -999 })
|
||||
.then(async (result) => { // this can be the an array or string depending on site.contents
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_FINISH, auditSource, { taskId, result, siteId: site.id });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_FINISH, auditSource, { taskId, result, siteId: site.id, siteName: site.name });
|
||||
})
|
||||
.catch(async (error) => {
|
||||
const timedOut = error.code === tasks.ETIMEOUT;
|
||||
await safe(eventlog.add(eventlog.ACTION_BACKUP_FINISH, auditSource, { taskId, errorMessage: error.message, timedOut, siteId: site.id }));
|
||||
await safe(eventlog.add(eventlog.ACTION_BACKUP_FINISH, auditSource, { taskId, errorMessage: error.message, timedOut, siteId: site.id, siteName: site.name }));
|
||||
})
|
||||
.finally(async () => {
|
||||
await locks.release(`${locks.TYPE_FULL_BACKUP_TASK_PREFIX}${site.id}`);
|
||||
|
||||
Reference in New Issue
Block a user