Merge lp:~sinzui/launchpad/prf-connection-0 into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 12371 | ||||
Proposed branch: | lp:~sinzui/launchpad/prf-connection-0 | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
257 lines (+40/-47) 2 files modified
lib/lp/registry/scripts/productreleasefinder/walker.py (+10/-4) lib/lp/registry/tests/test_prf_walker.py (+30/-43) |
||||
To merge this branch: | bzr merge lp:~sinzui/launchpad/prf-connection-0 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brad Crittenden (community) | code | Approve | |
Benji York (community) | code* | Approve | |
Review via email: mp+49456@code.launchpad.net |
Description of the change
Recover from an open() failure when the product-
Launchpad bug: https:/
Pre-
Test command: ./bin/test -vv -t test_prf_walker
The product release finder failed on the first use the an FTPWalker. This is
probably an operational issue where the site or the port is blocked.
Regardless of the connectivity issue, the PRF should not fail.
From the prf log:
2011-02-11 07:22:36 INFO Connecting to ftp.gnu.org
2011-02-11 07:22:36 ERROR Unhandled exception
From the tb in the librarian
File "/srv/launchpad
self.open()
File "/srv/launchpad
self.
File "/usr/lib/
self.sock = socket.
File "/usr/lib/
raise error, msg
error: [Errno 111] Connection refused
-------
RULES
* Catch the exception raise by self.open(), log the issue and return
early.
* ADDENDUM: The local imports are not needed in the tests now that
cyclic import issues were fixed.
QA
If ftp.gnu.org is blocking Lp:
* Run the product-release finder on staging and verify that the PRF
otherwise:
* Hope for the best.
LINT
lib/
lib/
^ lint hates the long lines in the test data. I can clean this up, but I think
it will make the test more difficult to read, so I chose it ignore it.
IMPLEMENTATION
I removed the local import from the test. I added a new test to instrument
an exception from open(). The prf often checks for (IOError, socket.error)
though I believe that in the known case, only socket.error will be raised.
I also fixed some deprecated uses of raise reported by lint.
lib/
lib/
Approved* (Brad will have to review my review since I'm doing mentored
reviews.)
The test (like the rest of the branch) is nice and clean. I almost
suggested using list(walker) instead of the (apparently) do-nothing
loop, but I'm not sure if using list() is just clearer to me and most
people would understand the intent of the current code better.
I especially like the fact that the WalkerBase import can be moved to
the top of the test module. Much nicer now.