Univention Bugzilla – Bug 49852
Better error message for duplicate objects, same (source_uid, record_uid,)
Last modified: 2023-10-19 17:36:17 CEST
Better error message for duplicate objects, same (sourceUid, recordUid,) A customer had some duplicates objects and got (rightfully) the following error. My problem is, that the problematic objects aren't printed. That wasn't impossible to find out, but could be easier. We looked at the last succesfull object in the log and investigated the next one. ''' 2019-07-12 00:14:21 ERROR mass_import.import_users:127 Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/mass_import.py", line 119, in import_users user_import.delete_users(users_to_delete) # 0% - 10% File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/user_import.py", line 376, in delete_users user = a_user.get_by_import_id(self.connection, source_uid, record_uid) File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 359, in get_by_import_id obj = cls.get_only_udm_obj(connection, filter_s, superordinate=superordinate) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 952, in get_only_udm_obj raise MultipleObjectsError(objs) MultipleObjectsError ''' No idea why "objs" isn't shown here.
(In reply to Jürn Brodersen from comment #0) > raise MultipleObjectsError(objs) > MultipleObjectsError > ''' > > No idea why "objs" isn't shown here. The exception class doesn't have a custom __str__() to show it. IMHO it could lead to information disclosure to display the filter and the objects DNs for all cases of the exception. So I wouldn't create a custom MultipleObjectsError.__str__(). Instead I suggest to capture it in ImportUser.get_by_import_id() and log both there, because here we know that the "information disclosure" is desired here.