do not restart mail container when not activated

provision code is calling setDashboardDomain() which is restarting
the mail server
This commit is contained in:
Girish Ramakrishnan
2019-02-26 19:43:18 -08:00
parent 20c0deeac4
commit 27f6177fc9
4 changed files with 28 additions and 10 deletions
+19 -2
View File
@@ -16,6 +16,7 @@ exports = module.exports = {
prepareDashboardDomain: prepareDashboardDomain,
setDashboardDomain: setDashboardDomain,
setDashboardAndMailDomain: setDashboardAndMailDomain,
renewCerts: renewCerts,
runSystemChecks: runSystemChecks,
@@ -356,6 +357,7 @@ function prepareDashboardDomain(domain, auditSource, callback) {
task.on('start', (taskId) => callback(null, taskId));
}
// call this only pre activation since it won't start mail server
function setDashboardDomain(domain, auditSource, callback) {
assert.strictEqual(typeof domain, 'string');
assert.strictEqual(typeof auditSource, 'object');
@@ -381,14 +383,29 @@ function setDashboardDomain(domain, auditSource, callback) {
eventlog.add(eventlog.ACTION_DASHBOARD_DOMAIN_UPDATE, auditSource, { domain: domain, fqdn: fqdn });
mail.setMailFqdn(fqdn, domain, NOOP_CALLBACK);
callback(null);
});
});
});
}
// call this only post activation because it will restart mail server
function setDashboardAndMailDomain(domain, auditSource, callback) {
assert.strictEqual(typeof domain, 'string');
assert.strictEqual(typeof auditSource, 'object');
assert.strictEqual(typeof callback, 'function');
debug(`setDashboardAndMailDomain: ${domain}`);
setDashboardDomain(domain, auditSource, function (error) {
if (error) return callback(error);
mail.onMailFqdnChanged(NOOP_CALLBACK); // this will update dns and re-configure mail server
callback(null);
});
}
function renewCerts(options, auditSource, callback) {
assert.strictEqual(typeof options, 'object');
assert.strictEqual(typeof auditSource, 'object');