Bug 51669 - KeyError: 'gidNumber' when trying to revert adding an object
KeyError: 'gidNumber' when trying to revert adding an object
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 5.0
Assigned To: Florian Best
Philipp Hahn
https://jenkins.knut.univention.de:81...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-07-14 18:49 CEST by Florian Best
Modified: 2021-05-25 16:02 CEST (History)
0 users

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
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:
best: Patch_Available+


Attachments
patch (978 bytes, patch)
2020-07-14 18:49 CEST, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2020-07-14 18:49:22 CEST
Created attachment 10428 [details]
patch

14.07.20 03:11:11.577  ADMIN       ( ERROR   ) : Creating 'cn=g5z0yaizzv,cn=groups,dc=AutoTest091,dc=local' failed: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/univention/admin/handlers/__init__.py", line 1284, in _create
    self._ldap_post_create()
  File "/usr/lib/python2.7/dist-packages/univention/admin/handlers/groups/group.py", line 631, in _ldap_post_create
    self.__update_membership()
  File "/usr/lib/python2.7/dist-packages/univention/admin/handlers/groups/group.py", line 752, in __update_membership
    self.__set_membership_attributes(group, members, newmembers)
  File "/usr/lib/python2.7/dist-packages/univention/admin/handlers/groups/group.py", line 768, in __set_membership_attributes
    self.lo.modify(group, [('uniqueMember', members, newmembers)])
  File "/usr/lib/python2.7/dist-packages/univention/admin/uldap.py", line 894, in modify
    raise univention.admin.uexceptions.noObject(dn)
noObject: cn=pz9scfg5no,cn=groups,dc=AutoTest091,dc=local

14.07.20 03:11:11.579  ADMIN       ( ERROR   ) : Post-create: remove() failed: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/univention/admin/handlers/__init__.py", line 1295, in _create
    self.remove()
  File "/usr/lib/python2.7/dist-packages/univention/admin/handlers/__init__.py", line 877, in remove
    return self._remove(remove_childs)
  File "/usr/lib/python2.7/dist-packages/univention/admin/handlers/__init__.py", line 1506, in _remove
    self._ldap_pre_remove()
  File "/usr/lib/python2.7/dist-packages/univention/admin/handlers/groups/group.py", line 645, in _ldap_pre_remove
    self.gidNum = self.oldattr['gidNumber'][0]
KeyError: 'gidNumber'


When creating an object fails, UDM removes the object again. This causes the removal code not to be executed fully because it might depend on self.oldattr to be set which is not set when the objects doesn't exist at all.

We should either set self.oldattr and everything else necessary for an object to be in a valid state or just get a new instance of the object.

We can see such a traceback every day in our Jenkins Tests.
Comment 1 Philipp Hahn univentionstaff 2020-10-15 15:43:21 CEST
univention-directory-manager-modules (15.0.2-10)
2345eacbef66 | Bug #51669: fix removal of objects during errors in create

OK: 2345eacbef66
FIXED:
[5.0-0] f8fe5a8917 Bug #51669 udm: Add changelog
 doc/changelog/changelog-5.0-0.xml | 6 ++++++
 1 file changed, 6 insertions(+)
Comment 2 Florian Best univentionstaff 2021-05-25 16:02:42 CEST
UCS 5.0 has been released:
 https://docs.software-univention.de/release-notes-5.0-0-en.html
 https://docs.software-univention.de/release-notes-5.0-0-de.html

If this error occurs again, please use "Clone This Bug".