Skip to content

Commit 3da9b3d

Browse files
committed
fix: database error handling during import of a non-user item
The code to handle the case of retired and active users causing errors during import can get called on other db errors as well (e.g. out of memory in postgresql). The code that trys to detect/repair the out of order user case hard coded the db.user class. This crashed when a db error occurred when loading another data object (e.g. msg). Fix the crash by using the proper db object class for the object class being loaded. Credit to Norbert Schlemmer for finding this.
1 parent 32ff105 commit 3da9b3d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ Fixed:
5656
Rouillard from issue on mailing list by Chuck Cunningham)
5757
- make roundup-server exit more quickly on ^C. This seems to be
5858
limited to windows. (John Rouillard)
59+
- Fix error handling so failure during import of a non-user item
60+
doesn't cause a second traceback. (Found by Norbert Schlemmer, fix
61+
John Rouillard)
5962

6063
Features:
6164

roundup/backends/rdbms_common.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,11 +3298,12 @@ def import_list(self, propnames, proplist):
32983298
logger.info('Attempting to handle import exception '
32993299
'for id %s: %s' % (newid, e))
33003300

3301-
keyname = self.db.user.getkey()
3301+
classdb = self.db.getclass(self.classname)
3302+
keyname = classdb.getkey()
33023303
if has_node or not keyname: # Not an integrity error
33033304
raise
33043305
self.db.restore_connection_on_error()
3305-
activeid = self.db.user.lookup(d[keyname])
3306+
activeid = classdb.lookup(d[keyname])
33063307
self.db.sql(retired_sql, (-1, activeid)) # clear the active node
33073308
# this can only happen on an addnode, so retry
33083309
try:

0 commit comments

Comments
 (0)