Bug 49852 - Better error message for duplicate objects, same (source_uid, record_uid,)
Better error message for duplicate objects, same (source_uid, record_uid,)
Status: NEW
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-07-16 10:18 CEST by Jürn Brodersen
Modified: 2023-10-19 17:36 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jürn Brodersen univentionstaff 2019-07-16 10:18:11 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.
Comment 1 Daniel Tröder univentionstaff 2019-07-16 11:53:46 CEST
(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.