Merge lp:~ev/oops-repository/whoopsie-daisy into lp:oops-repository

Proposed by Evan on 2012-02-21
Status: Merged
Merged at revision: 12
Proposed branch: lp:~ev/oops-repository/whoopsie-daisy
Merge into: lp:oops-repository
Diff against target: 44 lines (+9/-5)
1 file modified
oopsrepository/oopses.py (+9/-5)
To merge this branch: bzr merge lp:~ev/oops-repository/whoopsie-daisy
Reviewer Review Type Date Requested Status
Robert Collins 2012-02-21 Pending
Review via email: mp+93963@code.launchpad.net

Description of the change

r15 adds the ability to submit a user token along with the OOPS, to allow for the generation of 'crashes by user' and similar reports.

The user token passed to this is currently a SHA-512 hash of the system UUID.

To post a comment you must log in.
Robert Collins (lifeless) wrote :

A test for this would be nice; I'll merge it as-is as current tests
pass, and trust you'll follow up ;)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'oopsrepository/oopses.py'
2--- oopsrepository/oopses.py 2012-01-10 08:47:38 +0000
3+++ oopsrepository/oopses.py 2012-02-21 11:03:29 +0000
4@@ -54,7 +54,7 @@
5 map(batch.remove, days)
6 batch.send()
7
8-def insert(config, oopsid, oops_json):
9+def insert(config, oopsid, oops_json, user_token=None):
10 """Insert an OOPS into the system.
11
12 :return: The day which the oops was filed under.
13@@ -67,18 +67,18 @@
14 insert_dict = {}
15 for key, value in oops_dict.items():
16 insert_dict[key] = json.dumps(value)
17- return _insert(config, oopsid, insert_dict)
18+ return _insert(config, oopsid, insert_dict, user_token)
19
20-def insert_bson(config, oopsid, oops_bson):
21+def insert_bson(config, oopsid, oops_bson, user_token=None):
22 """Insert an OOPS into the system.
23
24 :return: The day which the oops was filed under.
25 """
26 oops_dict = bson.BSON(oops_bson)
27 insert_dict = oops_dict.to_dict()
28- return _insert(config, oopsid, insert_dict)
29+ return _insert(config, oopsid, insert_dict, user_token)
30
31-def _insert(config, oopsid, insert_dict):
32+def _insert(config, oopsid, insert_dict, user_token=None):
33 pool = pycassa.connect(config['keyspace'], config['host'])
34 dayoops_cf = pycassa.ColumnFamily(pool, 'DayOOPS')
35 oops_cf = pycassa.ColumnFamily(pool, 'OOPS')
36@@ -87,4 +87,8 @@
37
38 oops_cf.insert(oopsid, insert_dict)
39 dayoops_cf.insert(day_key, {now_uuid:oopsid})
40+ if user_token:
41+ useroops_cf = pycassa.ColumnFamily(pool, 'UserOOPS')
42+ useroops_cf.insert(user_token, {oopsid : ''})
43+
44 return day_key

Subscribers

People subscribed via source and target branches

to all changes: