diff --git a/src/addons.js b/src/addons.js index f690e44e1..17e4130f7 100644 --- a/src/addons.js +++ b/src/addons.js @@ -800,8 +800,6 @@ function exportDatabase(addon, callback) { function updateServiceConfig(platformConfig, callback) { callback = callback || NOOP_CALLBACK; - debug('updateServiceConfig: %j', platformConfig); - async.eachSeries([ 'mysql', 'postgresql', 'mail', 'mongodb', 'graphite' ], function iterator(serviceName, iteratorCallback) { const containerConfig = platformConfig[serviceName]; let memory, memorySwap; diff --git a/src/platform.js b/src/platform.js index 13cc58da6..01927b5fe 100644 --- a/src/platform.js +++ b/src/platform.js @@ -26,8 +26,6 @@ var addons = require('./addons.js'), tasks = require('./tasks.js'), _ = require('underscore'); -var NOOP_CALLBACK = function (error) { if (error) debug(error); }; - function start(callback) { assert.strictEqual(typeof callback, 'function'); @@ -45,7 +43,7 @@ function start(callback) { if (_.isEqual(infra, existingInfra)) { debug('platform is uptodate at version %s', infra.version); - onPlatformReady(); + onPlatformReady(false /* !infraChanged */); return callback(); } @@ -67,7 +65,7 @@ function start(callback) { locker.unlock(locker.OP_PLATFORM_START); - onPlatformReady(); + onPlatformReady(true /* infraChanged */); callback(); }); @@ -77,14 +75,18 @@ function stopAllTasks(callback) { tasks.stopAllTasks(callback); } -function onPlatformReady() { - debug('onPlatformReady: platform is ready'); +function onPlatformReady(infraChanged) { + debug(`onPlatformReady: platform is ready. infra changed: ${infraChanged}`); exports._isReady = true; - apps.schedulePendingTasks(NOOP_CALLBACK); + let tasks = [ apps.schedulePendingTasks ]; + if (infraChanged) tasks.push(applyPlatformConfig, pruneInfraImages); - applyPlatformConfig(NOOP_CALLBACK); - pruneInfraImages(NOOP_CALLBACK); + async.series(async.reflectAll(tasks), function (error, results) { + results.forEach((result, idx) => { + if (result.error) debug(`Startup task at index ${idx} failed: ${result.error.message}`); + }); + }); } function applyPlatformConfig(callback) {