Univention Bugzilla – Bug 33843
Removing IP address from Computer leads to traceback
Last modified: 2014-06-13 13:01:16 CEST
... when a DHCP entry was created before (?). Tested with computers/windows File "/usr/lib/pymodules/python2.6/notifier/threads.py", line 82, in _run tmp = self._function() File "/usr/lib/pymodules/python2.6/notifier/__init__.py", line 104, in __call__ return self._function( *tmp, **self._kwargs ) File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/__init__.py", line 373, in _thread module.modify( properties ) File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line 155, in wrapper_func ret = func( *args, **kwargs ) File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line 410, in modify obj.modify() File "/usr/lib/pymodules/python2.6/univention/admin/handlers/__init__.py", line 345, in modify return self._modify(modify_childs,ignore_license=ignore_license) File "/usr/lib/pymodules/python2.6/univention/admin/handlers/__init__.py", line 922, in _modify self._ldap_post_modify() File "/usr/lib/pymodules/python2.6/univention/admin/handlers/computers/windows.py", line 554, in _ldap_post_modify univention.admin.handlers.simpleComputer._ldap_post_modify( self ) File "/usr/lib/pymodules/python2.6/univention/admin/handlers/__init__.py", line 1934, in _ldap_post_modify self.__add_dns_forward_object( self[ 'name' ], dn, self[ 'ip' ][ 0 ] ) IndexError: list index out of range
Reported by UMC Traceback
Reported again: Ticket #2014032321001653
This was a common traceback which could occur when adding/removing DHCP or DNS zone to computer objects without IP address. I've fixed the problem in all code paths concerning the treatment of DHCP and DNS zones during computer creation as well as computer modification. YAML: 2014-04-07-univention-directory-manager-modules.yaml
*** Bug 34508 has been marked as a duplicate of this bug. ***
The problem was: self.ip not set: Prior to 3.2-0: self['ip'][0] == '' Now: self['ip'][0] => IndexError So: self.__modify_dhcp_object( dn, self[ 'name' ], self[ 'ip' ][ 0 ], self[ 'mac' ][ 0 ] ) could be called when ip was set or not set and mac was set or not set. After the patch, you check if self['ip'] and self['mac'] before calling which is not semantically the same. self.__modify_dhcp_object( dn, self[ 'name' ], self[ 'ip' ][ 0 ], self[ 'mac' ][ 0 ] ) will not be called with an IP but without a MAC. => REOPENED For backward compatibility, it might be better to have something like first_mac = '' if self['mac']: first_mac = self['mac'][0] and work with first_mac from now on.
I removed the commits, so that we can release UDM: r49400 + r49401 + r49405
Though I've found the same behaviour in other segments of the code, the patch has been modified and re-integrated afterwards. The new patch restores the old functionality as of times where [''] was the default value for empty attributes. It does so in the most simple, but also most line-intensive way aswell. Code changes: svn 49721 YAML: svn 49725 The new changes modify the post create and modify methods, because they had the same problem.
Seems to work - for most cases. Code review revealed: Line 1927 ff: ip = '' if self['ip']: ip = self['ip'][0] self.__add_dns_forward_object( self[ 'name' ], dn, ip ) self.__add_related_ptrrecords(dn, self['ip'][0]) (same with __remove_dns_forward_object / __remove_related_ptrrecords)
(In reply to Dirk Wiesenthal from comment #8) > Seems to work - for most cases. Code review revealed: > > Line 1927 ff: > > ip = '' > if self['ip']: > ip = self['ip'][0] > self.__add_dns_forward_object( self[ 'name' ], dn, ip ) > self.__add_related_ptrrecords(dn, self['ip'][0]) > > (same with __remove_dns_forward_object / __remove_related_ptrrecords) Fixed (svn 49956). I've also had a look for similar occurences, but found noone. New version in YAML: 9.0.75-32.1195.201405071555 Ported to ucs-3.2-2 as well.
VERIFIED, code review and testing for traceback. I also searched for problems in the code, did not find anything obvious. In any case, not scope of this bug. YAML Ok
http://errata.univention.de/ucs/3.2/109.html
*** Bug 34250 has been marked as a duplicate of this bug. ***