eventlog: rename backup site logs and fix eventlog summar
This commit is contained in:
@@ -262,7 +262,7 @@ async function setSchedule(backupSite, schedule, auditSource) {
|
||||
|
||||
await update(backupSite, { schedule });
|
||||
await cron.handleBackupScheduleChanged(Object.assign({}, backupSite, { schedule }));
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_TARGET_UPDATE, auditSource, { backupSite: removePrivateFields(backupSite), schedule });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_SITE_UPDATE, auditSource, { name: backupSite.name, schedule });
|
||||
}
|
||||
|
||||
async function setLimits(backupSite, limits, auditSource) {
|
||||
@@ -271,7 +271,7 @@ async function setLimits(backupSite, limits, auditSource) {
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
|
||||
await update(backupSite, { limits });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_TARGET_UPDATE, auditSource, { backupSite: removePrivateFields(backupSite), limits });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_SITE_UPDATE, auditSource, { name: backupSite.name, limits });
|
||||
}
|
||||
|
||||
async function setRetention(backupSite, retention, auditSource) {
|
||||
@@ -283,7 +283,7 @@ async function setRetention(backupSite, retention, auditSource) {
|
||||
if (error) throw error;
|
||||
|
||||
await update(backupSite, { retention });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_TARGET_UPDATE, auditSource, { backupSite: removePrivateFields(backupSite), retention });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_SITE_UPDATE, auditSource, { name: backupSite.name, retention });
|
||||
}
|
||||
|
||||
async function setEnabledForUpdates(backupSite, enableForUpdates, auditSource) {
|
||||
@@ -292,7 +292,7 @@ async function setEnabledForUpdates(backupSite, enableForUpdates, auditSource) {
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
|
||||
await update(backupSite, { enableForUpdates });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_TARGET_UPDATE, auditSource, { backupSite: removePrivateFields(backupSite), enableForUpdates });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_SITE_UPDATE, auditSource, { name: backupSite.name, enableForUpdates });
|
||||
}
|
||||
|
||||
async function setEncryption(backupSite, data, auditSource) {
|
||||
@@ -319,7 +319,7 @@ async function setEncryption(backupSite, data, auditSource) {
|
||||
if (error) throw error;
|
||||
if (result[1].affectedRows !== 1) throw new BoxError(BoxError.NOT_FOUND, 'Target not found');
|
||||
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_TARGET_UPDATE, auditSource, { backupSite: removePrivateFields(backupSite), encryption: !!encryption });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_SITE_UPDATE, auditSource, { name: backupSite.name, encryption: !!encryption });
|
||||
}
|
||||
|
||||
async function setName(backupSite, name, auditSource) {
|
||||
@@ -331,7 +331,7 @@ async function setName(backupSite, name, auditSource) {
|
||||
if (nameError) throw nameError;
|
||||
|
||||
await update(backupSite, { name });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_TARGET_UPDATE, auditSource, { backupSite: removePrivateFields(backupSite), name });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_SITE_UPDATE, auditSource, { name, oldName: backupSite.name });
|
||||
}
|
||||
|
||||
async function setContents(backupSite, contents, auditSource) {
|
||||
@@ -343,7 +343,7 @@ async function setContents(backupSite, contents, auditSource) {
|
||||
if (contentsError) throw contentsError;
|
||||
|
||||
await update(backupSite, { contents });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_TARGET_UPDATE, auditSource, { backupSite: removePrivateFields(backupSite), contents });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_SITE_UPDATE, auditSource, { name: backupSite.name, contents });
|
||||
}
|
||||
|
||||
async function del(backupSite, auditSource) {
|
||||
@@ -362,7 +362,7 @@ async function del(backupSite, auditSource) {
|
||||
if (error && error.sqlCode === 'ER_NO_REFERENCED_ROW_2') throw new BoxError(BoxError.NOT_FOUND, error);
|
||||
if (error) throw error;
|
||||
if (result[2].affectedRows !== 1) throw new BoxError(BoxError.NOT_FOUND, 'Target not found');
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_TARGET_REMOVE, auditSource, { backupSite: removePrivateFields(backupSite) });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_SITE_REMOVE, auditSource, { name: backupSite.name, backupSite: removePrivateFields(backupSite) });
|
||||
|
||||
backupSite.schedule = constants.CRON_PATTERN_NEVER;
|
||||
await cron.handleBackupScheduleChanged(backupSite);
|
||||
@@ -507,7 +507,7 @@ async function setConfig(backupSite, newConfig, auditSource) {
|
||||
debug('setConfig: setting up new storage configuration');
|
||||
await storageApi(backupSite).setup(sanitizedConfig);
|
||||
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_TARGET_UPDATE, auditSource, { backupSite: removePrivateFields(backupSite), newConfig });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_SITE_UPDATE, auditSource, { name: backupSite.name, config: storageApi(backupSite).removePrivateFields(newConfig) });
|
||||
}
|
||||
|
||||
async function add(data, auditSource) {
|
||||
@@ -558,7 +558,7 @@ async function add(data, auditSource) {
|
||||
debug('add: setting up new storage configuration');
|
||||
await storageApi({ provider }).setup(sanitizedConfig);
|
||||
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_TARGET_ADD, auditSource, { id, name, provider, contents, schedule, format });
|
||||
await eventlog.add(eventlog.ACTION_BACKUP_SITE_ADD, auditSource, { id, name, provider, contents, schedule, format });
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user