make cloudron.updateToLatest take an auditSource

This commit is contained in:
Girish Ramakrishnan
2016-05-01 13:15:30 -07:00
parent d811115f21
commit 8254337552
4 changed files with 16 additions and 7 deletions
+5 -1
View File
@@ -35,6 +35,7 @@ var apps = require('./apps.js'),
config = require('./config.js'),
debug = require('debug')('box:cloudron'),
df = require('node-df'),
eventlog = require('./eventlog.js'),
fs = require('fs'),
locker = require('./locker.js'),
mailer = require('./mailer.js'),
@@ -510,12 +511,15 @@ function update(boxUpdateInfo, callback) {
}
function updateToLatest(callback) {
function updateToLatest(auditSource, callback) {
assert.strictEqual(typeof auditSource, 'object');
assert.strictEqual(typeof callback, 'function');
var boxUpdateInfo = updateChecker.getUpdateInfo().box;
if (!boxUpdateInfo) return callback(new CloudronError(CloudronError.ALREADY_UPTODATE, 'No update available'));
eventlog.add(eventlog.ACTION_UPDATE, auditSource, { boxUpdateInfo: boxUpdateInfo });
update(boxUpdateInfo, callback);
}