Fix emails

This commit is contained in:
ponas committed 2015-03-18 21:20:18 +01:00
1 parent 2e023eed31
commit ecf4b9ce9a
3 files changed
+22 -10

No files matched your search

+11 -5
View File
@@ -82,15 +82,21 @@ class Command(BaseCommand):
if restart:
status, output = getstatusoutput(restart_command)
if status != 0:
mail_admins(
"FAIL: dhcpd %s -> %s" % (old_serial, config.active_serial),
"Failed to restart dhcp3-server, please inspect...\n\n",
message = (
"Failed to restart dhcp3-server, please inspect...\n\n" +
"%s@%s# %s" % (os.getlogin(), os.uname()[1], restart_command) +
"\n%s\n\n%s" % (output, diff))
mail_admins(
subject="FAIL: dhcpd %s -> %s" % (old_serial, config.active_serial),
message=message,
html_message='<pre>%s</pre>' % message)
sys.exit(1)
else:
mail_admins(
"Success: dhcpd %s -> %s" % (old_serial, config.active_serial),
message = (
"Updated dhcpd configuration to serial %d\n\n" % config.active_serial +
"%s" % diff)
mail_admins(
subject="Success: dhcpd %s -> %s" % (old_serial, config.active_serial),
message=message,
html_message='<pre>%s</pre>' % message)
sys.exit(0)
+10 -4
View File
@@ -71,19 +71,25 @@ class Command(BaseCommand):
status, output = getstatusoutput(self.reload_command)
if status != 0:
sys.stdout.write("fail\n")
mail_admins(
"FAIL: bind (%s changed zones)" % len(self.changes),
message = (
"Failed to reload bind, please inspect...\n\n" +
"%s@%s# %s" % (
os.getlogin(), os.uname()[1], self.reload_command) +
"\n%s\n\n\n%s\n\n\n%s" % (output, errors, diffs))
mail_admins(
subject="FAIL: bind (%s changed zones)" % len(self.changes),
message=message,
html_message='<pre>%s</pre>' % message)
sys.exit(1)
else:
sys.stdout.write("ok\n")
mail_admins(
"Success: bind (%s changed zones)" % len(self.changes),
message = (
"Successfully updated bind zone files\n\n" +
"%s\n\n%s" % (errors, diffs))
mail_admins(
subject="Success: bind (%s changed zones)" % len(self.changes),
message=message,
html_message='<pre>%s</pre>' % message)
sys.exit(0)
def update_zone(self, zone):
+1 -1
View File
@@ -146,7 +146,7 @@ LOGGING = {
}
}
EMAIL_SUBJECT_PREFIX = 'MDB'
EMAIL_SUBJECT_PREFIX = '[MDB] '
EMAIL_HOST = 'smtp.example.com'
EMAIL_PORT = 25