backups: change app backup filename

change from app_appid_timestamp_vVersion to app_fqdn_vVersion

Fixes #782
This commit is contained in:
Girish Ramakrishnan
2021-05-08 16:23:57 -07:00
parent 4482da6148
commit 91a7a9e43c
2 changed files with 7 additions and 9 deletions
+5 -9
View File
@@ -986,10 +986,7 @@ function rotateBoxBackup(backupConfig, tag, options, appBackupIds, progressCallb
assert.strictEqual(typeof progressCallback, 'function');
assert.strictEqual(typeof callback, 'function');
var snapshotInfo = getSnapshotInfo('box');
const snapshotTime = snapshotInfo.timestamp.replace(/[T.]/g, '-').replace(/[:Z]/g,''); // add this to filename to make it unique, so it's easy to download them
const backupId = util.format('%s/box_%s_v%s', tag, snapshotTime, constants.VERSION);
const backupId = `${tag}/box_${constants.VERSION}`;
const format = backupConfig.format;
debug(`Rotating box backup to id ${backupId}`);
@@ -1087,11 +1084,10 @@ function rotateAppBackup(backupConfig, app, tag, options, progressCallback, call
const startTime = new Date();
var snapshotInfo = getSnapshotInfo(app.id);
const snapshotInfo = getSnapshotInfo(app.id);
var manifest = snapshotInfo.restoreConfig ? snapshotInfo.restoreConfig.manifest : snapshotInfo.manifest; // compat
const snapshotTime = snapshotInfo.timestamp.replace(/[T.]/g, '-').replace(/[:Z]/g,''); // add this for unique filename which helps when downloading them
const backupId = util.format('%s/app_%s_%s_v%s', tag, app.id, snapshotTime, manifest.version);
const manifest = snapshotInfo.restoreConfig ? snapshotInfo.restoreConfig.manifest : snapshotInfo.manifest; // compat
const backupId = `${tag}/app_${app.fqdn}_v${manifest.version}`;
const format = backupConfig.format;
debug(`Rotating app backup of ${app.id} to id ${backupId}`);
@@ -1110,7 +1106,7 @@ function rotateAppBackup(backupConfig, app, tag, options, progressCallback, call
backupdb.add(backupId, data, function (error) {
if (error) return callback(error);
var copy = api(backupConfig.provider).copy(backupConfig, getBackupFilePath(backupConfig, `snapshot/app_${app.id}`, format), getBackupFilePath(backupConfig, backupId, format));
const copy = api(backupConfig.provider).copy(backupConfig, getBackupFilePath(backupConfig, `snapshot/app_${app.id}`, format), getBackupFilePath(backupConfig, backupId, format));
copy.on('progress', (message) => progressCallback({ message: `${message} (${app.fqdn})` }));
copy.on('done', function (copyBackupError) {
const state = copyBackupError ? exports.BACKUP_STATE_ERROR : exports.BACKUP_STATE_NORMAL;