Merge lp:~jcsackett/launchpad/hardwaredb-should-ignore-bad-data into lp:launchpad
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Данило Шеган | ||||||||
Approved revision: | no longer in the source branch. | ||||||||
Merged at revision: | 12787 | ||||||||
Proposed branch: | lp:~jcsackett/launchpad/hardwaredb-should-ignore-bad-data | ||||||||
Merge into: | lp:launchpad | ||||||||
Diff against target: |
181 lines (+73/-12) 3 files modified
lib/lp/hardwaredb/scripts/hwdbsubmissions.py (+25/-10) lib/lp/hardwaredb/tests/test_hwdb_submission_validation.py (+35/-2) lib/lp/services/scripts/base.py (+13/-0) |
||||||||
To merge this branch: | bzr merge lp:~jcsackett/launchpad/hardwaredb-should-ignore-bad-data | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Данило Шеган (community) | Approve | ||
Review via email: mp+56472@code.launchpad.net |
Commit message
[r=danilo][bug=676988,747532] Disables oops creation for hardware processing errors introduced by bad data we do not control.
Description of the change
Summary
=======
Bad data sent to the HWDB caused an OOPS when it failed to validate. While we want to log the bad data as an error, we don't want it to generate an OOPS and get in the OOPS report, because there's nothing we can do about it beyond report bad data coming in from another source.
Preimplementation
=================
Spoke with Curtis Hovey, and explored the problem with him.
Implementation
==============
lib/lp/
-------
Added a contextmanager for the OopsHandler that temporarily removes it from a logger, and adds it back in after the context expires.
lib/lp/
-------
Updated the self._logError method for the script to take a parameter indicating whether or not an Oops should be created. The contextmanager created in base.py is used to disable the Oopshandler if the parameter is false. It defaults to true.
lib/canonical/
lib/lp/
-------
Tests and test data.
Tests
=====
bin/test -vvct test_hwdb
QA
==
Create a hardware db entry on qastaging, staging, or launchpad.dev, using bad data (the data from the bug's linked oops report would be fine). Fire of the process-
Lint
====
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/canonical
lib/lp/
lib/lp/
lib/lp/
As discussed on IRC, I dislike having a big XML file in the code with no clear indication what exactly is it about (other than being "bad" :), so you agreed: "in order, i'll try: modifying the data on the fly; cleaning everything possible out of the file; adding a big comment."
Regarding the XXX and cElementTree import in lib/lp/ hardwaredb/ scripts/ hwdbsubmissions .py, JFDI is my suggestion.
Also, it'd be nice to have a minimal test for context-manager disable_ oops_handler just so nobody breaks it for you.