Merge lp:~rye/python-oops-tools/u1-prefix-support into lp:python-oops-tools

Proposed by Roman Yepishev
Status: Merged
Approved by: Robert Collins
Approved revision: 20
Merged at revision: 20
Proposed branch: lp:~rye/python-oops-tools/u1-prefix-support
Merge into: lp:python-oops-tools
Diff against target: 44 lines (+21/-3)
2 files modified
src/oopstools/oops/models.py (+10/-3)
src/oopstools/oops/test/test_dboopsloader.py (+11/-0)
To merge this branch: bzr merge lp:~rye/python-oops-tools/u1-prefix-support
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+82556@code.launchpad.net

Commit message

Handle the form of oops prefix guessing that U1 needs.

Description of the change

This adds U1 OOPS prefix format parsing. Test for the OOPS-<hash> passed too.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Thanks for this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/oopstools/oops/models.py'
2--- src/oopstools/oops/models.py 2011-11-16 22:46:04 +0000
3+++ src/oopstools/oops/models.py 2011-11-17 16:19:23 +0000
4@@ -281,11 +281,18 @@
5 if not prefix:
6 # Legacy support for pre-reporter using OOPSes.
7 prefix_match = oops_re.match(oopsid)
8- # 37 is len (OOPS-<hash>).
9- if prefix_match is not None and len(oopsid) < 37:
10+ if prefix_match:
11 prefix = prefix_match.group('oopsprefix')
12- else:
13+ # Ubuntu One format is prefixZuuid.
14+ if len(prefix) > 33 and prefix[-33] == 'Z':
15+ prefix = prefix[:-33]
16+ elif len(oopsid) >= 37:
17+ # 37 is len (OOPS-<hash>).
18+ prefix = None
19+
20+ if not prefix:
21 prefix = 'UNKNOWN'
22+
23 prefix = prefix.upper()
24 try:
25 prefix = Prefix.objects.get(value__exact=prefix)
26
27=== modified file 'src/oopstools/oops/test/test_dboopsloader.py'
28--- src/oopstools/oops/test/test_dboopsloader.py 2011-11-16 07:43:57 +0000
29+++ src/oopstools/oops/test/test_dboopsloader.py 2011-11-17 16:19:23 +0000
30@@ -242,3 +242,14 @@
31 }
32 oops = parsed_oops_to_model_oops(report, 'bug-889982')
33 self.assertEqual('UNKNOWN', oops.appinstance.title)
34+
35+ def test_u1_report_id_bug_891647(self):
36+ # Ubuntu One web apps use their own flavour of unique identifier for
37+ # the oopses: prefixZuuid_encoded. We need to make sure that prefix
38+ # does not end up being such a string.
39+ report = {
40+ 'id': 'OOPS-2147appserver'\
41+ 'ZCeCCGJBHEHJCEdABaIIJDCbaJbaAbDce175347',
42+ }
43+ oops = parsed_oops_to_model_oops(report, 'bug-891647')
44+ self.assertEqual('APPSERVER', oops.appinstance.title)

Subscribers

People subscribed via source and target branches

to all changes: