Univention Bugzilla – Bug 37832
AttributeError: 'NoneType' object has no attribute 'find' when changing IP/MAC addresses
Last modified: 2018-04-13 13:29:18 CEST
Execution of command 'udm/put computers/computer' has failed: Traceback (most recent call last): File "%PY2.7%/univention/management/console/modules/__init__.py", line 176, in _decorated return function(self, request, *args, **kwargs) File "%PY2.7%/notifier/threads.py", line 82, in _run tmp = self._function() File "%PY2.7%/notifier/__init__.py", line 104, in __call__ return self._function( *tmp, **self._kwargs ) File "%PY2.7%/univention/management/console/modules/udm/__init__.py", line 408, in _thread module.modify(properties) File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 159, in _decorated return func(*args, **kwargs) File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 139, in wrapper_func ret = func(*args, **kwargs) File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 547, in modify obj.modify() File "%PY2.7%/univention/admin/handlers/__init__.py", line 364, in modify return self._modify(modify_childs,ignore_license=ignore_license) File "%PY2.7%/univention/admin/handlers/__init__.py", line 962, in _modify self._ldap_post_modify() File "%PY2.7%/univention/admin/handlers/computers/domaincontroller_backup.py", line 585, in _ldap_post_modify univention.admin.handlers.simpleComputer._ldap_post_modify( self ) File "%PY2.7%/univention/admin/handlers/__init__.py", line 2007, in _ldap_post_modify self.__add_dns_forward_object( self[ 'name' ], dn, ip ) File "%PY2.7%/univention/admin/handlers/__init__.py", line 1831, in __add_dns_forward_object if ip.find(':')!=-1: #IPv6 AttributeError: 'NoneType' object has no attribute 'find' Remark: Updating Computers in UCSM Version: 4.0-1 errata82 (Walle)
Created attachment 6721 [details] patch He reported it again, 4.0-1 errata84 (Walle) It is reproducible by having a computer object with 2 MAC or IP addresses but no IP. When assigning the DNS forward zone for this object, leaving the IP address field emtpy, this traceback occurs. I don't know why he want to do this but here is a patch.
(In reply to Florian Best from comment #1) > It is reproducible by having a computer object with 2 MAC or IP addresses > but no IP. but no IP at the forward zone.
# udm computers/ipmanagedclient create \ > --position "cn=computers,$(ucr get ldap/base)" \ > --set name=storage00 \ > --set description="IBM Storwize V3700" \ > --append inventoryNumber=11S00AR104YM1BBG4CE08K \ > --append inventoryNumber=11S00AR104YM1BBG4CF0ET \ > --append mac=98:be:94:0f:03:5e \ > --append mac=98:be:94:0f:03:5f \ > --append mac=00:90:fa:8b:15:0c \ > --append mac=00:90:fa:8b:15:0e \ > --append ip=10.200.38.10 \ > --append ip=192.168.70.121 \ > --append ip=192.168.70.122 \ > --append mac=98:be:94:0f:08:0c \ > --append mac=98:be:94:0f:08:0d \ > --append mac=00:90:fa:8b:14:e0 \ > --append mac=00:90:fa:8b:14:e2 \ > --set dnsEntryZoneForward="$(udm dns/forward_zone list | sed -ne 's/^DN: //p;T;q')" \ > --set dnsEntryZoneReverse="$(udm dns/reverse_zone list | sed -ne 's/^DN: //p;T;q')" Traceback (most recent call last): File "/usr/share/univention-directory-manager-tools/univention-cli-server", line 222, in doit output = univention.admincli.admin.doit(arglist) File "/usr/lib/pymodules/python2.7/univention/admincli/admin.py", line 393, in doit out=_doit(arglist) File "/usr/lib/pymodules/python2.7/univention/admincli/admin.py", line 804, in _doit dn=object.create() File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 352, in create return self._create() File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 790, in _create self._ldap_post_create() File "/usr/lib/pymodules/python2.7/univention/admin/handlers/computers/ipmanagedclient.py", line 278, in _ldap_post_create univention.admin.handlers.simpleComputer._ldap_post_create( self ) File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 2377, in _ldap_post_create self.__add_dns_forward_object( self[ 'name' ], dn, ip ) File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 1831, in __add_dns_forward_object if ip.find(':')!=-1: #IPv6 AttributeError: 'NoneType' object has no attribute 'find'
(In reply to Philipp Hahn from comment #3) > > --set dnsEntryZoneForward="$(udm dns/forward_zone list | sed -ne 's/^DN: //p;T;q')" \ > > --set dnsEntryZoneReverse="$(udm dns/reverse_zone list | sed -ne 's/^DN: //p;T;q')" Well, this is kind of wrong syntax (for multi-ip hosts). It would work if you set: --set dnsEntryZoneForward="$(udm dns/forward_zone list | sed -ne 's/^DN: //p;T;q') 192.168.70.121" --set dnsEntryZoneReverse="$(udm dns/reverse_zone list | sed -ne 's/^DN: //p;T;q') 192.168.70.121" Nevertheless I think if no IP for the DNS forward zone/ reverse zone / DHCP zonewas provided we should add every IP? Multiple entries can be added in this way (does somehow not work for dnsEntryZoneReverse): udm computers/ipmanagedclient create \ --position "cn=computers,$(ucr get ldap/base)" \ --set name=storage00 \ --set description="IBM Storwize V3700" \ --append inventoryNumber=11S00AR104YM1BBG4CE08K \ --append inventoryNumber=11S00AR104YM1BBG4CF0ET \ --append mac=98:be:94:0f:03:5e \ --append mac=98:be:94:0f:03:5f \ --append mac=00:90:fa:8b:15:0c \ --append mac=00:90:fa:8b:15:0e \ --append ip=10.200.38.10 \ --append ip=192.168.70.121 \ --append ip=192.168.70.122 \ --append mac=98:be:94:0f:08:0c \ --append mac=98:be:94:0f:08:0d \ --append mac=00:90:fa:8b:14:e0 \ --append mac=00:90:fa:8b:14:e2 \ --append dnsEntryZoneForward="$(udm dns/forward_zone list | sed -ne 's/^DN: //p;T;q') 10.200.38.10" \ --append dnsEntryZoneForward="$(udm dns/forward_zone list | sed -ne 's/^DN: //p;T;q') 192.168.70.121" \ --append dnsEntryZoneForward="$(udm dns/forward_zone list | sed -ne 's/^DN: //p;T;q') 192.168.70.122" \ --append dnsEntryZoneReverse="$(udm dns/reverse_zone list --filter zoneName=38.200.10.in-addr.arpa | sed -ne 's/^DN: //p;T;q') 10.200.38.10" \ --append dnsEntryZoneReverse="$(udm dns/reverse_zone list --filter zoneName=70.168.192.in-addr.arpa | sed -ne 's/^DN: //p;T;q') 192.168.70.121" \ --append dnsEntryZoneReverse="$(udm dns/reverse_zone list --filter zoneName=70.168.192.in-addr.arpa | sed -ne 's/^DN: //p;T;q') 192.168.70.122"
Reported again, 4.1-1 errata116 The patch (attachment 6721 [details]) would prevent the traceback but wouldn't set the correct settings. Better would be to add a entry in the forward zone for every IP: + elif not ip: + for ip in self['ip']: + self.__add_dns_forward_object(self['name'], dn, ip) The error also happens if the IP address is malformed.
May be fixed by r74612 in UCS-4.2-0
Comment on attachment 6721 [details] patch >diff --git a/ucs-4.0-1/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py b/ucs-4.0-1/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >index 57fe579..1d2d2a8 100644 >--- a/ucs-4.0-1/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >+++ b/ucs-4.0-1/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >@@ -2003,7 +2003,7 @@ def _ldap_post_modify( self ): > ip = self['ip'][0] > self.__add_dns_forward_object( self[ 'name' ], dn, ip ) > self.__add_related_ptrrecords(dn, ip) >- else: >+ elif ip: > self.__add_dns_forward_object( self[ 'name' ], dn, ip ) > self.__add_related_ptrrecords(dn, ip) >
*** This bug has been marked as a duplicate of bug 16923 ***