From d1a1f7004b176a82ef71cf0a13514eca8e8af868 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Wed, 6 Feb 2019 17:17:57 +0100 Subject: [PATCH] Do not send out emails for out of disk We rely now on notifications. We should hover send emails about critical new notifications. Lets make the admin go to the dashboard to check the situation. --- src/mail_templates/out_of_disk_space.ejs | 22 ---------------------- src/mailer.js | 20 -------------------- src/notifications.js | 1 - 3 files changed, 43 deletions(-) delete mode 100644 src/mail_templates/out_of_disk_space.ejs diff --git a/src/mail_templates/out_of_disk_space.ejs b/src/mail_templates/out_of_disk_space.ejs deleted file mode 100644 index a312311fa..000000000 --- a/src/mail_templates/out_of_disk_space.ejs +++ /dev/null @@ -1,22 +0,0 @@ -<%if (format === 'text') { %> - -Dear <%= cloudronName %> Admin, - -your server is running out of disk space. - -Disk space logs are attached. - -------------------------------------- - -<%- message %> - -------------------------------------- - - -Powered by https://cloudron.io - -Sent at: <%= new Date().toUTCString() %> - -<% } else { %> - -<% } %> diff --git a/src/mailer.js b/src/mailer.js index 6f5a48a22..7db8136dc 100644 --- a/src/mailer.js +++ b/src/mailer.js @@ -15,7 +15,6 @@ exports = module.exports = { appDied: appDied, oomEvent: oomEvent, - outOfDiskSpace: outOfDiskSpace, backupFailed: backupFailed, certificateRenewalError: certificateRenewalError, @@ -32,7 +31,6 @@ var assert = require('assert'), debug = require('debug')('box:mailer'), docker = require('./docker.js').connection, ejs = require('ejs'), - mail = require('./mail.js'), nodemailer = require('nodemailer'), path = require('path'), safe = require('safetydance'), @@ -440,24 +438,6 @@ function sendDigest(info) { }); } -function outOfDiskSpace(mailTo, message) { - assert.strictEqual(typeof mailTo, 'string'); - assert.strictEqual(typeof message, 'string'); - - getMailConfig(function (error, mailConfig) { - if (error) return debug('Error getting mail details:', error); - - var mailOptions = { - from: mailConfig.notificationFrom, - to: mailTo, - subject: util.format('[%s] Out of disk space alert', mailConfig.cloudronName), - text: render('out_of_disk_space.ejs', { cloudronName: mailConfig.cloudronName, message: message, format: 'text' }) - }; - - sendMails([ mailOptions ]); - }); -} - function backupFailed(error) { var message = splatchError(error); diff --git a/src/notifications.js b/src/notifications.js index 9ead6140b..37e647dc4 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -296,7 +296,6 @@ function diskSpaceWarning(message) { assert.strictEqual(typeof message, 'string'); actionForAllAdmins([], function (admin, callback) { - mailer.outOfDiskSpace(admin.email, message); upsert(admin.id, null, 'Out of Disk Space', message, '/#/graphs', callback); }, function (error) { if (error) console.error(error);