Fix use of skipBackup

also, store it in the eventlog
This commit is contained in:
Girish Ramakrishnan
2019-09-26 20:10:11 -07:00
parent a266fe13d0
commit a3420f885d

View File

@@ -1248,6 +1248,8 @@ function update(appId, data, auditSource, callback) {
debug(`update: id:${appId}`);
const skipBackup = !!data.skipBackup;
get(appId, function (error, app) {
if (error) return callback(error);
@@ -1257,17 +1259,13 @@ function update(appId, data, auditSource, callback) {
downloadManifest(data.appStoreId, data.manifest, function (error, appStoreId, manifest) {
if (error) return callback(error);
var updateConfig = {
skipBackup: !!data.skipBackup
};
error = manifestFormat.parse(manifest);
if (error) return callback(new AppsError(AppsError.BAD_FIELD, 'Manifest error:' + error.message));
error = checkManifestConstraints(manifest);
if (error) return callback(error);
updateConfig.manifest = manifest;
var updateConfig = { skipBackup, manifest };
// prevent user from installing a app with different manifest id over an existing app
// this allows cloudron install -f --app <appid> for an app installed from the appStore
@@ -1312,7 +1310,7 @@ function update(appId, data, auditSource, callback) {
addTask(appId, exports.ISTATE_PENDING_UPDATE, task, function (error, result) {
if (error) return callback(error);
eventlog.add(eventlog.ACTION_APP_UPDATE, auditSource, { appId: appId, toManifest: manifest, fromManifest: app.manifest, force: data.force, app: app, taskId: result.taskId });
eventlog.add(eventlog.ACTION_APP_UPDATE, auditSource, { appId, app, skipBackup, toManifest: manifest, fromManifest: app.manifest, force: data.force, taskId: result.taskId });
// clear update indicator, if update fails, it will come back through the update checker
updateChecker.resetAppUpdateInfo(appId);