Merge lp:~cjwatson/launchpad/opt-in-zopeless-immediate-mail into lp:launchpad

Proposed by Colin Watson
Status: Rejected
Rejected by: Colin Watson
Proposed branch: lp:~cjwatson/launchpad/opt-in-zopeless-immediate-mail
Merge into: lp:launchpad
Prerequisite: lp:~cjwatson/launchpad/more-pop-notifications
Diff against target: 421 lines (+67/-49)
14 files modified
daemons/buildd-manager.tac (+2/-8)
lib/lp/bugs/scripts/bugnotification.py (+11/-2)
lib/lp/bugs/scripts/tests/test_bugnotification.py (+1/-1)
lib/lp/bugs/tests/bugs-emailinterface.txt (+6/-11)
lib/lp/code/mail/codehandler.py (+1/-1)
lib/lp/services/job/celeryjob.py (+1/-3)
lib/lp/services/job/runner.py (+8/-7)
lib/lp/services/mail/basemailer.py (+7/-2)
lib/lp/services/mail/sendmail.py (+13/-1)
lib/lp/services/mail/tests/incomingmail.txt (+6/-2)
lib/lp/services/mail/tests/test_incoming.py (+2/-0)
lib/lp/services/scripts/base.py (+1/-6)
lib/lp/testing/layers.py (+1/-5)
scripts/mlist-import.py (+7/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/opt-in-zopeless-immediate-mail
Reviewer Review Type Date Requested Status
Launchpad code reviewers Pending
Review via email: mp+270383@code.launchpad.net

Commit message

Disable Zopeless immediate mail delivery, except for BaseMailer, job OOPS/error notifications, and a few other places that still need it.

Description of the change

Disable Zopeless immediate mail delivery, except for BaseMailer, job OOPS/error notifications, and a few other places that still need it.

This is a step towards being able to disable it across the board so that we can avoid ever having situations where operation/mail/operation/mail sequences send duplicate mail if a non-first operation fails and has to be retried. There are still several things that need to be fixed, notably archiveuploader; but this branch at least means that it's disabled for tests by default, which will simplify the process of fixing archiveuploader.

To post a comment you must log in.
Revision history for this message
Jes Slow (cluelesscoder) wrote :

This seems pretty stale - is it even relevant at this point?

I accidentally clicked a red "-" button - not sure what it did, sorry if it screwed something up.

Revision history for this message
Jes Slow (cluelesscoder) wrote :

OK, looking around at the UI elsewhere I guess I must've removed a related bug - is there a log anywhere where I can find that bug and re-add it?

Revision history for this message
Colin Watson (cjwatson) wrote :

It's absolutely still relevant; it's just a fairly invasive change so it's probably scared off reviewers. :-) I've restored the bug link.

Revision history for this message
Jes Slow (cluelesscoder) wrote :

Bit off-topic to ask this here, but I suppose there's no log where I could look up my change where I removed the bug report? Also wondering if I could pull up a list of my past comments...? Hunted around for a bug report (33 at https://bugs.launchpad.net/launchpad?field.searchtext=activity+log) and noticed that I can pull up an "Full Activity Log" at a bug report like https://bugs.launchpad.net/launchpad/+bug/294644

Basically would like a full activity log for myself.

Also found https://bugs.launchpad.net/launchpad/+bug/787668 which I suppose could cover this? I can leave a comment there.

Revision history for this message
Colin Watson (cjwatson) wrote :

I got it in email about this merge proposal, and it's in the activity log for the bug, but but merge proposals don't themselves have an activity log. You can search for bugs on which you've commented, but there likewise isn't a full activity log for everything a person has done (and that part is pretty much exactly bug 787668).

This is indeed off-topic here though, as you say, and it'd be best not to continue this conversation in this merge proposal because it's likely to get in the way of people reviewing it.

Revision history for this message
Colin Watson (cjwatson) wrote :

Unmerged revisions

17726. By Colin Watson

Drop immediate mail delivery from LaunchpadScript and LaunchpadZopelessLayer.

17725. By Colin Watson

Drop explicit immediate mail delivery from buildd-manager; build mail all goes via BaseMailer now, which handles that.

17724. By Colin Watson

Drop immediate mail delivery from jobs, except for OOPS and user error notifications.

17723. By Colin Watson

Fix CodeHandler to abort before sending error notifications.

17722. By Colin Watson

Force immediate mail delivery for MailingListImport.

17721. By Colin Watson

Force immediate mail delivery for bug notifications and BaseMailer, which rely on this for SMTP exception handling.

17720. By Colin Watson

Adjust some tests to stop assuming immediate mail delivery.

17719. By Colin Watson

Introduce an immediate_mail_delivery context manager, allowing more fine-grained control.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'daemons/buildd-manager.tac'
--- daemons/buildd-manager.tac 2011-12-29 05:29:36 +0000
+++ daemons/buildd-manager.tac 2015-09-08 11:52:24 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the1# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4# Twisted Application Configuration file.4# Twisted Application Configuration file.
@@ -6,20 +6,15 @@
66
7from twisted.application import service7from twisted.application import service
8from twisted.scripts.twistd import ServerOptions8from twisted.scripts.twistd import ServerOptions
9from twisted.web import server
109
10from lp.buildmaster.manager import BuilddManager
11from lp.services.config import dbconfig11from lp.services.config import dbconfig
12from lp.services.daemons import readyservice12from lp.services.daemons import readyservice
13from lp.services.scripts import execute_zcml_for_scripts13from lp.services.scripts import execute_zcml_for_scripts
14from lp.buildmaster.manager import BuilddManager
15from lp.services.mail.sendmail import set_immediate_mail_delivery
16from lp.services.twistedsupport.loggingsupport import RotatableFileLogObserver14from lp.services.twistedsupport.loggingsupport import RotatableFileLogObserver
1715
18execute_zcml_for_scripts()16execute_zcml_for_scripts()
19dbconfig.override(dbuser='buildd_manager', isolation_level='read_committed')17dbconfig.override(dbuser='buildd_manager', isolation_level='read_committed')
20# XXX wgrant 2011-09-24 bug=29744: initZopeless used to do this.
21# Should be removed from callsites verified to not need it.
22set_immediate_mail_delivery(True)
2318
24options = ServerOptions()19options = ServerOptions()
25options.parseOptions()20options.parseOptions()
@@ -34,4 +29,3 @@
34# Service for scanning buildd slaves.29# Service for scanning buildd slaves.
35service = BuilddManager()30service = BuilddManager()
36service.setServiceParent(application)31service.setServiceParent(application)
37
3832
=== modified file 'lib/lp/bugs/scripts/bugnotification.py'
--- lib/lp/bugs/scripts/bugnotification.py 2015-08-06 12:09:28 +0000
+++ lib/lp/bugs/scripts/bugnotification.py 2015-09-08 11:52:24 +0000
@@ -35,7 +35,10 @@
35from lp.services.database.constants import UTC_NOW35from lp.services.database.constants import UTC_NOW
36from lp.services.mail.helpers import get_email_template36from lp.services.mail.helpers import get_email_template
37from lp.services.mail.mailwrapper import MailWrapper37from lp.services.mail.mailwrapper import MailWrapper
38from lp.services.mail.sendmail import sendmail38from lp.services.mail.sendmail import (
39 immediate_mail_delivery,
40 sendmail,
41 )
39from lp.services.scripts.base import LaunchpadCronScript42from lp.services.scripts.base import LaunchpadCronScript
40from lp.services.scripts.logger import log43from lp.services.scripts.logger import log
41from lp.services.webapp import canonical_url44from lp.services.webapp import canonical_url
@@ -339,7 +342,7 @@
339342
340343
341class SendBugNotifications(LaunchpadCronScript):344class SendBugNotifications(LaunchpadCronScript):
342 def main(self):345 def send_notifications(self):
343 notifications_sent = False346 notifications_sent = False
344 bug_notification_set = getUtility(IBugNotificationSet)347 bug_notification_set = getUtility(IBugNotificationSet)
345 deferred_notifications = \348 deferred_notifications = \
@@ -392,3 +395,9 @@
392395
393 if not notifications_sent:396 if not notifications_sent:
394 self.logger.debug("No notifications are pending to be sent.")397 self.logger.debug("No notifications are pending to be sent.")
398
399 def main(self):
400 # XXX cjwatson 2015-09-05 bug=29744: SMTP exception handling here
401 # currently relies on this.
402 with immediate_mail_delivery(True):
403 self.send_notifications()
395404
=== modified file 'lib/lp/bugs/scripts/tests/test_bugnotification.py'
--- lib/lp/bugs/scripts/tests/test_bugnotification.py 2015-08-06 12:09:28 +0000
+++ lib/lp/bugs/scripts/tests/test_bugnotification.py 2015-09-08 11:52:24 +0000
@@ -1368,7 +1368,7 @@
1368 "send-bug-notifications", config.malone.bugnotification_dbuser,1368 "send-bug-notifications", config.malone.bugnotification_dbuser,
1369 ["-q"])1369 ["-q"])
1370 script.txn = self.layer.txn1370 script.txn = self.layer.txn
1371 script.main()1371 script.send_notifications()
13721372
1373 self.assertEqual(1, len(self.oopses))1373 self.assertEqual(1, len(self.oopses))
1374 self.assertIn(1374 self.assertIn(
13751375
=== modified file 'lib/lp/bugs/tests/bugs-emailinterface.txt'
--- lib/lp/bugs/tests/bugs-emailinterface.txt 2015-07-21 09:04:01 +0000
+++ lib/lp/bugs/tests/bugs-emailinterface.txt 2015-09-08 11:52:24 +0000
@@ -81,8 +81,8 @@
8181
82 >>> def process_email(raw_mail):82 >>> def process_email(raw_mail):
83 ... msg = construct_email(raw_mail)83 ... msg = construct_email(raw_mail)
84 ... handler.process(msg, msg['To'],84 ... handler.process(msg, msg['To'])
85 ... )85 ... transaction.commit()
8686
87 >>> process_email(submit_mail)87 >>> process_email(submit_mail)
8888
@@ -454,9 +454,7 @@
454 ... signature = None454 ... signature = None
455 >>> msg = email.message_from_string(455 >>> msg = email.message_from_string(
456 ... comment_mail, _class=MockUnsignedMessage)456 ... comment_mail, _class=MockUnsignedMessage)
457 >>> handler.process(457 >>> handler.process(msg, msg['To'])
458 ... msg, msg['To'],
459 ... )
460 True458 True
461 >>> transaction.commit()459 >>> transaction.commit()
462460
@@ -514,9 +512,7 @@
514 ... return construct_email(edit_mail)512 ... return construct_email(edit_mail)
515513
516 >>> def submit_command_email(msg):514 >>> def submit_command_email(msg):
517 ... handler.process(515 ... handler.process(msg, msg['To'])
518 ... msg, msg['To'],
519 ... )
520 ... transaction.commit()516 ... transaction.commit()
521517
522 >>> def submit_commands(bug, *commands):518 >>> def submit_commands(bug, *commands):
@@ -1805,10 +1801,9 @@
1805 >>> msg = signed_message_from_string(submit_mail)1801 >>> msg = signed_message_from_string(submit_mail)
1806 >>> import email.utils1802 >>> import email.utils
1807 >>> msg['Message-Id'] = email.utils.make_msgid()1803 >>> msg['Message-Id'] = email.utils.make_msgid()
1808 >>> handler.process(1804 >>> handler.process(msg, msg['To'])
1809 ... msg, msg['To'],
1810 ... )
1811 True1805 True
1806 >>> transaction.commit()
1812 >>> print_latest_email()1807 >>> print_latest_email()
1813 Subject: Submit Request Failure1808 Subject: Submit Request Failure
1814 To: test@canonical.com1809 To: test@canonical.com
18151810
=== modified file 'lib/lp/code/mail/codehandler.py'
--- lib/lp/code/mail/codehandler.py 2015-07-08 16:05:11 +0000
+++ lib/lp/code/mail/codehandler.py 2015-09-08 11:52:24 +0000
@@ -316,11 +316,11 @@
316 message, context.vote, context.vote_tags, mail)316 message, context.vote, context.vote_tags, mail)
317317
318 except IncomingEmailError as error:318 except IncomingEmailError as error:
319 transaction.abort()
319 send_process_error_notification(320 send_process_error_notification(
320 str(user.preferredemail.email),321 str(user.preferredemail.email),
321 'Submit Request Failure',322 'Submit Request Failure',
322 error.message, mail, error.failing_command)323 error.message, mail, error.failing_command)
323 transaction.abort()
324 return True324 return True
325325
326 @staticmethod326 @staticmethod
327327
=== modified file 'lib/lp/services/job/celeryjob.py'
--- lib/lp/services/job/celeryjob.py 2015-08-03 07:06:45 +0000
+++ lib/lp/services/job/celeryjob.py 2015-09-08 11:52:24 +0000
@@ -1,4 +1,4 @@
1# Copyright 2012 Canonical Ltd. This software is licensed under the1# Copyright 2012-2015 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Celery-specific Job code.4"""Celery-specific Job code.
@@ -34,7 +34,6 @@
34 install_feature_controller,34 install_feature_controller,
35 make_script_feature_controller,35 make_script_feature_controller,
36 )36 )
37from lp.services.mail.sendmail import set_immediate_mail_delivery
38from lp.services.job.model.job import (37from lp.services.job.model.job import (
39 Job,38 Job,
40 UniversalJobSource,39 UniversalJobSource,
@@ -139,7 +138,6 @@
139 return138 return
140 transaction.abort()139 transaction.abort()
141 scripts.execute_zcml_for_scripts(use_web_security=False)140 scripts.execute_zcml_for_scripts(use_web_security=False)
142 set_immediate_mail_delivery(True)
143 needs_zcml = False141 needs_zcml = False
144142
145143
146144
=== modified file 'lib/lp/services/job/runner.py'
--- lib/lp/services/job/runner.py 2015-08-04 00:19:36 +0000
+++ lib/lp/services/job/runner.py 2015-09-08 11:52:24 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2012 Canonical Ltd. This software is licensed under the1# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Facilities for running Jobs."""4"""Facilities for running Jobs."""
@@ -72,8 +72,8 @@
72 IRunnableJob,72 IRunnableJob,
73 )73 )
74from lp.services.mail.sendmail import (74from lp.services.mail.sendmail import (
75 immediate_mail_delivery,
75 MailController,76 MailController,
76 set_immediate_mail_delivery,
77 )77 )
78from lp.services.twistedsupport import run_reactor78from lp.services.twistedsupport import run_reactor
79from lp.services.webapp import errorlog79from lp.services.webapp import errorlog
@@ -177,7 +177,9 @@
177 """Report this oops."""177 """Report this oops."""
178 ctrl = self.getOopsMailController(oops['id'])178 ctrl = self.getOopsMailController(oops['id'])
179 if ctrl is not None:179 if ctrl is not None:
180 ctrl.send()180 # XXX cjwatson 2015-09-06 bug=29744: Can this be removed?
181 with immediate_mail_delivery(True):
182 ctrl.send()
181183
182 def getOopsVars(self):184 def getOopsVars(self):
183 """See `IRunnableJob`."""185 """See `IRunnableJob`."""
@@ -187,7 +189,9 @@
187 """See `IRunnableJob`."""189 """See `IRunnableJob`."""
188 ctrl = self.getUserErrorMailController(e)190 ctrl = self.getUserErrorMailController(e)
189 if ctrl is not None:191 if ctrl is not None:
190 ctrl.send()192 # XXX cjwatson 2015-09-06 bug=29744: Can this be removed?
193 with immediate_mail_delivery(True):
194 ctrl.send()
191195
192 def makeOopsReport(self, oops_config, info):196 def makeOopsReport(self, oops_config, info):
193 """Generate an OOPS report using the given OOPS configuration."""197 """Generate an OOPS report using the given OOPS configuration."""
@@ -406,9 +410,6 @@
406 scripts.execute_zcml_for_scripts(use_web_security=False)410 scripts.execute_zcml_for_scripts(use_web_security=False)
407 signal(SIGHUP, handler)411 signal(SIGHUP, handler)
408 dbconfig.override(dbuser=cls.dbuser, isolation_level='read_committed')412 dbconfig.override(dbuser=cls.dbuser, isolation_level='read_committed')
409 # XXX wgrant 2011-09-24 bug=29744: initZopeless used to do this.
410 # Should be removed from callsites verified to not need it.
411 set_immediate_mail_delivery(True)
412413
413 @staticmethod414 @staticmethod
414 def __exit__(exc_type, exc_val, exc_tb):415 def __exit__(exc_type, exc_val, exc_tb):
415416
=== modified file 'lib/lp/services/mail/basemailer.py'
--- lib/lp/services/mail/basemailer.py 2015-08-25 14:05:24 +0000
+++ lib/lp/services/mail/basemailer.py 2015-09-08 11:52:24 +0000
@@ -20,6 +20,7 @@
20from lp.services.mail.sendmail import (20from lp.services.mail.sendmail import (
21 append_footer,21 append_footer,
22 format_address,22 format_address,
23 immediate_mail_delivery,
23 MailController,24 MailController,
24 )25 )
25from lp.services.utils import text_delta26from lp.services.utils import text_delta
@@ -204,8 +205,12 @@
204205
205 def sendAll(self):206 def sendAll(self):
206 """Send notifications to all recipients."""207 """Send notifications to all recipients."""
207 for email, recipient in sorted(self._recipients.getRecipientPersons()):208 # XXX cjwatson 2015-09-05 bug=29744: We currently depend on this to
208 self.sendOne(email, recipient)209 # handle SMTPExceptions in the correct place.
210 with immediate_mail_delivery(True):
211 for email, recipient in sorted(
212 self._recipients.getRecipientPersons()):
213 self.sendOne(email, recipient)
209214
210215
211class RecipientReason:216class RecipientReason:
212217
=== modified file 'lib/lp/services/mail/sendmail.py'
--- lib/lp/services/mail/sendmail.py 2015-07-21 09:04:01 +0000
+++ lib/lp/services/mail/sendmail.py 2015-09-08 11:52:24 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the1# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""The One True Way to send mail from the Launchpad application.4"""The One True Way to send mail from the Launchpad application.
@@ -19,6 +19,7 @@
19 'format_address',19 'format_address',
20 'format_address_for_person',20 'format_address_for_person',
21 'get_msgid',21 'get_msgid',
22 'immediate_mail_delivery',
22 'MailController',23 'MailController',
23 'sendmail',24 'sendmail',
24 'set_immediate_mail_delivery',25 'set_immediate_mail_delivery',
@@ -29,6 +30,7 @@
2930
3031
31from binascii import b2a_qp32from binascii import b2a_qp
33from contextlib import contextmanager
32from email import charset34from email import charset
33from email.encoders import encode_base6435from email.encoders import encode_base64
34from email.header import Header36from email.header import Header
@@ -178,6 +180,16 @@
178 _immediate_mail_delivery = enabled180 _immediate_mail_delivery = enabled
179181
180182
183@contextmanager
184def immediate_mail_delivery(enabled):
185 """Context manager to temporarily change immediate mail delivery."""
186 global _immediate_mail_delivery
187 previous = _immediate_mail_delivery
188 set_immediate_mail_delivery(enabled)
189 yield
190 set_immediate_mail_delivery(previous)
191
192
181def simple_sendmail(from_addr, to_addrs, subject, body, headers=None,193def simple_sendmail(from_addr, to_addrs, subject, body, headers=None,
182 bulk=True):194 bulk=True):
183 """Send an email from from_addr to to_addrs with the subject and body195 """Send an email from from_addr to to_addrs with the subject and body
184196
=== modified file 'lib/lp/services/mail/tests/incomingmail.txt'
--- lib/lp/services/mail/tests/incomingmail.txt 2015-09-08 11:52:24 +0000
+++ lib/lp/services/mail/tests/incomingmail.txt 2015-09-08 11:52:24 +0000
@@ -45,16 +45,20 @@
4545
46Now we send a few test mails to foo.com, bar.com, and baz.com:46Now we send a few test mails to foo.com, bar.com, and baz.com:
4747
48 >>> import transaction
48 >>> from lp.services.mail.tests.helpers import read_test_message49 >>> from lp.services.mail.tests.helpers import read_test_message
49 >>> from lp.services.mail.sendmail import sendmail as original_sendmail50 >>> from lp.services.mail.sendmail import sendmail as original_sendmail
50 >>> from lp.testing.dbuser import switch_dbuser51 >>> from lp.testing.dbuser import switch_dbuser
5152
52For these examples, we don't want the Precedence header added. Domains53For these examples, we don't want the Precedence header added. Domains
53are treated without regard to case: for incoming mail, foo.com and54are treated without regard to case: for incoming mail, foo.com and
54FOO.COM are treated equivalently.55FOO.COM are treated equivalently. We also commit to ensure that mail is
56sent immediately.
5557
56 >>> def sendmail(msg, to_addrs=None):58 >>> def sendmail(msg, to_addrs=None):
57 ... return original_sendmail(msg, to_addrs=to_addrs, bulk=False)59 ... msgid = original_sendmail(msg, to_addrs=to_addrs, bulk=False)
60 ... transaction.commit()
61 ... return msgid
5862
59 >>> switch_dbuser('launchpad')63 >>> switch_dbuser('launchpad')
60 >>> msgids = {'foo.com': [], 'bar.com': [], 'baz.com': []}64 >>> msgids = {'foo.com': [], 'bar.com': [], 'baz.com': []}
6165
=== modified file 'lib/lp/services/mail/tests/test_incoming.py'
--- lib/lp/services/mail/tests/test_incoming.py 2015-07-08 16:05:11 +0000
+++ lib/lp/services/mail/tests/test_incoming.py 2015-09-08 11:52:24 +0000
@@ -75,6 +75,7 @@
75 email_address, 'to@example.com', 'subject', invalid_body,75 email_address, 'to@example.com', 'subject', invalid_body,
76 bulk=False)76 bulk=False)
77 ctrl.send()77 ctrl.send()
78 transaction.commit()
78 handleMail()79 handleMail()
79 self.assertEqual([], self.oopses)80 self.assertEqual([], self.oopses)
80 [notification] = pop_notifications()81 [notification] = pop_notifications()
@@ -101,6 +102,7 @@
101 email_address, 'to@example.com', 'subject', fat_body,102 email_address, 'to@example.com', 'subject', fat_body,
102 bulk=False)103 bulk=False)
103 ctrl.send()104 ctrl.send()
105 transaction.commit()
104 handleMail()106 handleMail()
105 self.assertEqual([], self.oopses)107 self.assertEqual([], self.oopses)
106 [notification] = pop_notifications()108 [notification] = pop_notifications()
107109
=== modified file 'lib/lp/services/scripts/base.py'
--- lib/lp/services/scripts/base.py 2014-08-29 01:34:04 +0000
+++ lib/lp/services/scripts/base.py 2015-09-08 11:52:24 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2012 Canonical Ltd. This software is licensed under the1# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4__metaclass__ = type4__metaclass__ = type
@@ -44,7 +44,6 @@
44 install_feature_controller,44 install_feature_controller,
45 make_script_feature_controller,45 make_script_feature_controller,
46 )46 )
47from lp.services.mail.sendmail import set_immediate_mail_delivery
48from lp.services.scripts.interfaces.scriptactivity import IScriptActivitySet47from lp.services.scripts.interfaces.scriptactivity import IScriptActivitySet
49from lp.services.scripts.logger import OopsHandler48from lp.services.scripts.logger import OopsHandler
50from lp.services.webapp.errorlog import globalErrorUtility49from lp.services.webapp.errorlog import globalErrorUtility
@@ -307,10 +306,6 @@
307 self._init_zca(use_web_security=use_web_security)306 self._init_zca(use_web_security=use_web_security)
308 self._init_db(isolation=isolation)307 self._init_db(isolation=isolation)
309308
310 # XXX wgrant 2011-09-24 bug=29744: initZopeless used to do this.
311 # Should be called directly by scripts that actually need it.
312 set_immediate_mail_delivery(True)
313
314 date_started = datetime.datetime.now(UTC)309 date_started = datetime.datetime.now(UTC)
315 profiler = None310 profiler = None
316 if self.options.profile:311 if self.options.profile:
317312
=== modified file 'lib/lp/testing/layers.py'
--- lib/lp/testing/layers.py 2013-08-14 11:15:51 +0000
+++ lib/lp/testing/layers.py 2015-09-08 11:52:24 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2012 Canonical Ltd. This software is licensed under the1# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Layers used by Launchpad tests.4"""Layers used by Launchpad tests.
@@ -1498,10 +1498,6 @@
1498 @profiled1498 @profiled
1499 def testSetUp(cls):1499 def testSetUp(cls):
1500 dbconfig.override(isolation_level='read_committed')1500 dbconfig.override(isolation_level='read_committed')
1501 # XXX wgrant 2011-09-24 bug=29744: initZopeless used to do this.
1502 # Tests that still need it should eventually set this directly,
1503 # so the whole layer is not polluted.
1504 set_immediate_mail_delivery(True)
15051501
1506 # Connect Storm1502 # Connect Storm
1507 reconnect_stores()1503 reconnect_stores()
15081504
=== modified file 'scripts/mlist-import.py'
--- scripts/mlist-import.py 2013-01-07 02:40:55 +0000
+++ scripts/mlist-import.py 2015-09-08 11:52:24 +0000
@@ -24,6 +24,7 @@
2424
25from lp.registry.scripts.mlistimport import Importer25from lp.registry.scripts.mlistimport import Importer
26from lp.services.config import config26from lp.services.config import config
27from lp.services.mail.sendmail import set_immediate_mail_delivery
27from lp.services.scripts.base import LaunchpadScript28from lp.services.scripts.base import LaunchpadScript
2829
2930
@@ -56,6 +57,12 @@
5657
57 def main(self):58 def main(self):
58 """See `LaunchpadScript`."""59 """See `LaunchpadScript`."""
60 # XXX cjwatson 2015-09-06 bug=29744: We need immediate mail delivery
61 # for the current implementation of the --notifications switch, and
62 # because the tests expect notifications to end up in
63 # LayerProcessController.smtp_controller.
64 set_immediate_mail_delivery(True)
65
59 team_name = None66 team_name = None
60 if len(self.args) == 0:67 if len(self.args) == 0:
61 self.parser.error('Missing team name')68 self.parser.error('Missing team name')