← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~mbp/launchpad/892427-service-failure into lp:launchpad

 

Martin Pool has proposed merging lp:~mbp/launchpad/892427-service-failure into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #892427 in Launchpad itself: "mysterious failure when rabbit fails to start in make run"
  https://bugs.launchpad.net/launchpad/+bug/892427

For more details, see:
https://code.launchpad.net/~mbp/launchpad/892427-service-failure/+merge/82766

see bug 892427 and https://code.launchpad.net/~mbp/rabbitfixture/rabbit-startup/+merge/80285
-- 
https://code.launchpad.net/~mbp/launchpad/892427-service-failure/+merge/82766
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mbp/launchpad/892427-service-failure into lp:launchpad.
=== modified file 'lib/canonical/launchpad/scripts/runlaunchpad.py'
--- lib/canonical/launchpad/scripts/runlaunchpad.py	2011-11-14 06:58:37 +0000
+++ lib/canonical/launchpad/scripts/runlaunchpad.py	2011-11-19 04:44:24 +0000
@@ -13,6 +13,8 @@
 import subprocess
 import sys
 
+from testtools.testresult.real import _details_to_str
+
 import fixtures
 from lazr.config import as_host_port
 from rabbitfixture.server import RabbitServerResources
@@ -433,20 +435,36 @@
     if setup is not None:
         # This is the setup from start_testapp, above.
         setup()
-    with nested(*services):
-        # Store our process id somewhere
-        make_pidfile('launchpad')
-        if config.launchpad.launch:
-            main(argv)
-        else:
-            # We just need the foreground process to sit around forever
-            # waiting for the signal to shut everything down.  Normally,
-            # Zope itself would be this master process, but we're not
-            # starting that up, so we need to do something else.
-            try:
-                signal.pause()
-            except KeyboardInterrupt:
-                pass
+    try:
+        with nested(*services):
+            # Store our process id somewhere
+            make_pidfile('launchpad')
+            if config.launchpad.launch:
+                main(argv)
+            else:
+                # We just need the foreground process to sit around forever
+                # waiting for the signal to shut everything down.  Normally,
+                # Zope itself would be this master process, but we're not
+                # starting that up, so we need to do something else.
+                try:
+                    signal.pause()
+                except KeyboardInterrupt:
+                    pass
+    except Exception, e:
+        print >>sys.stderr, "stopping services on exception %r" % e
+        for service in services:
+            print >>sys.stderr, service, "fixture details:"
+            # There may be no details on some services if they haven't been
+            # initialized yet.
+            if getattr(service, '_details', None) is None:
+                print >>sys.stderr, "(not ready yet?)"
+                continue
+            details_str = _details_to_str(service.getDetails())
+            if details_str:
+                print >>sys.stderr, details_str
+            else:
+                print >>sys.stderr, "(no details present)"
+        raise
 
 
 def start_librarian():