mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-16 13:01:29 +00:00
email: Log a message when we send emails
This commit is contained in:
parent
c05b687185
commit
5f4c2e735d
@ -156,7 +156,7 @@ class EmailPolicy(BasePolicy, Rest):
|
|||||||
(source_name, version, "stuck" if stuck else "not stuck"))
|
(source_name, version, "stuck" if stuck else "not stuck"))
|
||||||
if stuck:
|
if stuck:
|
||||||
self.log("[email dry run] Age %d >= threshold %d: would email: %s" %
|
self.log("[email dry run] Age %d >= threshold %d: would email: %s" %
|
||||||
(excuse.daysold or 0, max_age, self.lp_get_emails(source_name, version)))
|
(age, max_age, self.lp_get_emails(source_name, version)))
|
||||||
# don't update the cache file in dry run mode; we'll see all output each time
|
# don't update the cache file in dry run mode; we'll see all output each time
|
||||||
return PolicyVerdict.PASS
|
return PolicyVerdict.PASS
|
||||||
if stuck and not sent:
|
if stuck and not sent:
|
||||||
@ -169,6 +169,8 @@ class EmailPolicy(BasePolicy, Rest):
|
|||||||
msg['To'] = ', '.join(emails)
|
msg['To'] = ', '.join(emails)
|
||||||
try:
|
try:
|
||||||
with smtplib.SMTP('localhost') as smtp:
|
with smtplib.SMTP('localhost') as smtp:
|
||||||
|
self.log ("%s/%s stuck for %d days, emailing %s" %
|
||||||
|
(source_name, version, age, ', '.join(emails)))
|
||||||
smtp.send_message(msg)
|
smtp.send_message(msg)
|
||||||
sent = True
|
sent = True
|
||||||
except ConnectionRefusedError as err:
|
except ConnectionRefusedError as err:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user