Bug 33843 - Removing IP address from Computer leads to traceback
Removing IP address from Computer leads to traceback
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Computers
UCS 3.2
Other Linux
: P5 normal (vote)
: UCS 3.2-1-errata
Assigned To: Lukas Walter
Dirk Wiesenthal
:
: 34508 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-01-06 09:04 CET by Dirk Wiesenthal
Modified: 2014-06-13 13:01 CEST (History)
4 users (show)

See Also:
What kind of report is it?: ---
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): Error handling
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Wiesenthal univentionstaff 2014-01-06 09:04:53 CET
... 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
Comment 1 Dirk Wiesenthal univentionstaff 2014-01-14 12:33:04 CET
Reported by UMC Traceback
Comment 2 Stefan Gohmann univentionstaff 2014-03-24 06:48:59 CET
Reported again: Ticket #2014032321001653
Comment 3 Lukas Walter univentionstaff 2014-04-07 17:21:51 CEST
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
Comment 4 Stefan Gohmann univentionstaff 2014-04-09 06:10:23 CEST
*** Bug 34508 has been marked as a duplicate of this bug. ***
Comment 5 Dirk Wiesenthal univentionstaff 2014-04-16 14:21:07 CEST
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.
Comment 6 Stefan Gohmann univentionstaff 2014-04-16 14:44:05 CEST
I removed the commits, so that we can release UDM: r49400 + r49401 + r49405
Comment 7 Lukas Walter univentionstaff 2014-04-30 12:18:19 CEST
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.
Comment 8 Dirk Wiesenthal univentionstaff 2014-05-06 21:25:05 CEST
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)
Comment 9 Lukas Walter univentionstaff 2014-05-07 15:53:56 CEST
(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.
Comment 10 Dirk Wiesenthal univentionstaff 2014-05-08 00:33:20 CEST
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
Comment 11 Moritz Muehlenhoff univentionstaff 2014-05-08 11:06:39 CEST
http://errata.univention.de/ucs/3.2/109.html
Comment 12 Lukas Walter univentionstaff 2014-06-13 13:01:16 CEST
*** Bug 34250 has been marked as a duplicate of this bug. ***