← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~adeuring/launchpad/librarian-oopses into lp:launchpad/devel

 

Abel Deuring has proposed merging lp:~adeuring/launchpad/librarian-oopses into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


The template lib/canonical/launchpad/templates/launchpad-librarianfailure.pt did not display an OOPS ID, which made it unnecessary hard to figure out what was going on regarding our recent Librarian related failures. II added the OOPS ID to the template, and a test of this template.

test: ./bin/test -t xx-librarian-upload-errors.txt

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/canonical/launchpad/pagetests/standalone/xx-librarian-upload-errors.txt
  lib/canonical/launchpad/templates/launchpad-librarianfailure.pt

./lib/canonical/launchpad/pagetests/standalone/xx-librarian-upload-errors.txt
      11: source exceeds 78 characters.
      24: source exceeds 78 characters.

These lines are part of MIME formatted POST data -- difficult to make them shorter.
-- 
https://code.launchpad.net/~adeuring/launchpad/librarian-oopses/+merge/36315
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~adeuring/launchpad/librarian-oopses into lp:launchpad/devel.
=== added file 'lib/canonical/launchpad/pagetests/standalone/xx-librarian-upload-errors.txt'
--- lib/canonical/launchpad/pagetests/standalone/xx-librarian-upload-errors.txt	1970-01-01 00:00:00 +0000
+++ lib/canonical/launchpad/pagetests/standalone/xx-librarian-upload-errors.txt	2010-09-22 15:12:54 +0000
@@ -0,0 +1,64 @@
+Librarian errors
+================
+
+Librarian errors are shown in a special error page. We record OOPSes
+for these failures and display the OOPS ID in the error message.
+
+    >>> from canonical.config import config
+    >>> post_data = r"""
+    ... POST /firefox/+bug/1/+addcomment HTTP/1.1
+    ... Authorization: Basic Zm9vLmJhckBjYW5vbmljYWwuY29tOnRlc3Q=
+    ... Content-Type: multipart/form-data; boundary=---------------------------482515227376903752137397980
+    ...
+    ... -----------------------------482515227376903752137397980
+    ... Content-Disposition: form-data; name="field.subject"
+    ...
+    ... Re: Firefox does not support SVG
+    ... -----------------------------482515227376903752137397980
+    ... Content-Disposition: form-data; name="field.comment"
+    ...
+    ... -----------------------------482515227376903752137397980
+    ... Content-Disposition: form-data; name="field.filecontent.used"
+    ...
+    ... -----------------------------482515227376903752137397980
+    ... Content-Disposition: form-data; name="field.filecontent"; filename="foo.txt"
+    ... Content-Type: text/plain
+    ...
+    ... file content
+    ...
+    ... -----------------------------482515227376903752137397980
+    ... Content-Disposition: form-data; name="field.patch.used"
+    ...
+    ... -----------------------------482515227376903752137397980
+    ... Content-Disposition: form-data; name="field.attachment_description"
+    ...
+    ... -----------------------------482515227376903752137397980
+    ... Content-Disposition: form-data; name="field.actions.save"
+    ...
+    ... Post Comment
+    ... -----------------------------482515227376903752137397980--
+    ... """
+    >>> real_upload_port = config.librarian.upload_port
+    >>> # We can force a Librarian error by setting the Librarian upload
+    >>> # port to the download port.
+    >>> config.librarian.update(
+    ...     [('upload_port', str(config.librarian.download_port))])
+    []
+    >>> response = http(post_data)
+    >>> print extract_text(response.getOutput())
+    HTTP/1.1 500 Internal Server Error
+    ...
+    Sorry, you can't do this right now
+    Sorry, you can't upload or download files from Launchpad at the moment,
+    because we're doing feng shui in the server room. Normal service will
+    resume within an hour.
+    We’ve recorded what happened. The error ID is:
+    OOPS-...
+    Traceback (most recent call last):
+    ...
+    UploadFailed: Server said: foo.txt 501 Not Implemented<br />
+    ...
+
+    >>> config.librarian.update(
+    ...     [('upload_port', str(real_upload_port))])
+    []

=== modified file 'lib/canonical/launchpad/templates/launchpad-librarianfailure.pt'
--- lib/canonical/launchpad/templates/launchpad-librarianfailure.pt	2009-07-24 04:26:14 +0000
+++ lib/canonical/launchpad/templates/launchpad-librarianfailure.pt	2010-09-22 15:12:54 +0000
@@ -14,6 +14,9 @@
       because we're doing feng shui in the server room.  Normal service will
       resume within an hour.
       </p>
+      <p>We&#8217;ve recorded what happened. The error ID is:
+        <tal:oops replace="structure view/oops_id_text" />
+      </p>
       <tal:replace tal:replace="structure view/maybeShowTraceback" />
     </div>
   </body>