Univention Bugzilla – Bug 42928
Trying to create an existing group does not raise udm_errors.objectExists
Last modified: 2016-12-14 12:36:46 CET
When trying to create an already existing group, I get an exception (which is good). This exception is univention.admin.uexceptions.groupNameAlreadyUsed (which I think is bad). When writing generic functions, I expect this to work: def create_if_not_exists(object): try: obj.create() except udm_errors.objectExists: pass It does not for groups. Did not test users. A function like this exists in the App Center. In the App Center itself, it is currently not called with 'groups/group', though.
See management/univention-directory-manager-modules/modules/univention/admincli/admin.py +745. This bug - if it is correct usage of UDM - will probably also affect ucs-test.
Created attachment 8219 [details] patch If you want to get the objectExists exception you need to pass a DN. This is not done in the current code, so you will never get objectExists! I attached a patch which does what you want, it's not very nice but with the current function signature only this is possible. The patch also fixes another misusage: The code operates on obj.info directly. This must not be done. It causes that no syntax validations are done and even more validations like: * property may not change * property is required but not set * property is not allowed to change on AD-objects * it's not detected that a default value is overwritten, leading to followup-errors if the object is further used * singlevalue properties might contain multiple entries * property value has an invalid syntax * property value with wrong encoding might be written into LDAP
management/univention-appcenter/umc/python/appcenter/app_center.py:» » » » container_obj.info['name'] = container → Also has to be fixed.
For now, it somehow does not matter. Needs to be fixed eventually, because more UDM objects will be created by univention-appcenter (like settings/extended_attribute)
univention-appcenter 5.0.23-18.246.201612081850
OK: fix ~OK: YAML (very technical but it is technical) OK: workaround for Bug #43148
<http://errata.software-univention.de/ucs/4.1/357.html>