Univention Bugzilla – Bug 47922
Creating report fails if referenced objects do not exists: AttributeError: 'NoneType' object has no attribute 'info'
Last modified: 2019-03-13 13:30:10 CET
A users wants to create a PDF report about the clients. In the computers module, they search for IP managed clients, property network, network: *. The expected result is a report with several hundred entries. Result is "Internal server error in ---------- UCS Version: 4.3-1 errata160 (Neustadt) Interner Server-Fehler in "udm/reports/create (computers/computer)". AttributeError: 'NoneType' object has no attribute 'info' if token.attrs['name'] in base.info: File "/usr/lib/pymodules/python2.7/univention/directory/reports/interpreter.py", line 163, in attribute self.attribute(token, base_objects[0]) File "/usr/lib/pymodules/python2.7/univention/directory/reports/interpreter.py", line 95, in run self.run(token, token.objects) File "/usr/lib/pymodules/python2.7/univention/directory/reports/interpreter.py", line 80, in run interpret.run() File "/usr/lib/pymodules/python2.7/univention/directory/reports/document.py", line 128, in create_source tmpfile = doc.create_source(objects) File "/usr/lib/pymodules/python2.7/univention/directory/reports/report.py", line 69, in create report_file = report.create(request.flavor, request.options['report'], request.options['objects']) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 626, in _thread result = func(*args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/management/console/ldap.py", line 143, in _decorated return method(*args, **kwargs) File "/usr/lib/pymodules/python2.7/unive
28.11.18 15:15:49.380 MAIN ( PROCESS ) : CPCommand (10.25.31.236:60756) response error: {'traceback': ' File "/usr/lib/pymodules/python2.7/notifier/threads.py", line 78, in _run\n tmp = self._function()\n File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__\n return self._function( *tmp, **self._kwargs )\n File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 84, in _decorated\n return method(*args, **kwargs)\n File "/usr/lib/pymodules/python2.7/univention/management/console/ldap.py", line 143, in _decorated\n result = func(*args, **kwargs)\n File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 651, in _thread\n report_file = report.create(request.flavor, request.options[\'report\'], request.options[\'objects\'])\n File "/usr/lib/pymodules/python2.7/univention/directory/reports/report.py", line 69, in create\n tmpfile = doc.create_source(objects)\n File "/usr/lib/pymodules/python2.7/univention/directory/reports/document.py", line 128, in create_source\n interpret.run()\n File "/usr/lib/pymodules/python2.7/univention/directory/reports/interpreter.py", line 80, in run\n self.run(token, token.objects)\n File "/usr/lib/pymodules/python2.7/univention/directory/reports/interpreter.py", line 95, in run\n self.attribute(token, base_objects[0])\n File "/usr/lib/pymodules/python2.7/univention/directory/reports/interpreter.py", line 163, in attribute\n if token.attrs[\'name\'] in base.info:\nAttributeError: \'NoneType\' object has no attribute \'info\'\n', 'command': 'udm/reports/create (inventory/item)'} 28.11.18 15:15:49.380 MAIN ( ERROR ) : Interner Server-Fehler in "udm/reports/create (inventory/item)". Request: udm/reports/create (inventory/item) File "/usr/lib/pymodules/python2.7/notifier/threads.py", line 78, in _run tmp = self._function() File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__ return self._function( *tmp, **self._kwargs ) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 84, in _decorated return method(*args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/management/console/ldap.py", line 143, in _decorated result = func(*args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 651, in _thread report_file = report.create(request.flavor, request.options['report'], request.options['objects']) File "/usr/lib/pymodules/python2.7/univention/directory/reports/report.py", line 69, in create tmpfile = doc.create_source(objects) File "/usr/lib/pymodules/python2.7/univention/directory/reports/document.py", line 128, in create_source interpret.run() File "/usr/lib/pymodules/python2.7/univention/directory/reports/interpreter.py", line 80, in run self.run(token, token.objects) File "/usr/lib/pymodules/python2.7/univention/directory/reports/interpreter.py", line 95, in run self.attribute(token, base_objects[0]) File "/usr/lib/pymodules/python2.7/univention/directory/reports/interpreter.py", line 163, in attribute if token.attrs['name'] in base.info: AttributeError: 'NoneType' object has no attribute 'info' ######################################################################### In the univention-management-console-moduel-udm.log I found these messages, repeating for lots of clients: 28.11.18 15:13:25.164 ADMIN ( ERROR ) : univention.admin.objects.get(): The object cn=P034202,ou=Notebooks,ou=Rechner,dc=schein,dc=local is not a computers/ipmanagedclient. Ignoring this error. 28.11.18 15:13:25.172 ADMIN ( ERROR ) : object cn=P034202,ou=Notebooks,ou=Rechner,dc=schein,dc=local is not recognized as computers/ipmanagedclient. 28.11.18 15:13:25.311 ADMIN ( ERROR ) : univention.admin.objects.get(): The object cn=P034033,ou=Notebooks,ou=Rechner,dc=schein,dc=local is not a computers/ipmanagedclient. Ignoring this error. [...] 28.11.18 15:15:49.295 ADMIN ( ERROR ) : object cn=P032031,ou=Standort2,ou=Rechner,dc=schein,dc=local is not recognized as computers/ipmanagedclient. 28.11.18 15:15:49.378 MODULE ( PROCESS ) : Interner Server-Fehler in "udm/reports/create (inventory/item)".
This seems to be related to a custom udm extension. While this needs to be fixed for the extension, it would be nice to have a better error message.
Created attachment 9823 [details] interpreter.py.patch This patch does not solve the underlying problem, but helped the customer to create reports again. So until we figure out the real problem, we should go with this patch
Created attachment 9833 [details] patch This error might happen if the objects have references which don't exists, e.g. policies / groups / etc. I attached a patch, which ignores those objects. Let's use this patch instead of the hack.
(In reply to Florian Best from comment #8) > Created attachment 9833 [details] > patch > > This error might happen if the objects have references which don't exists, > e.g. policies / groups / etc. > > I attached a patch, which ignores those objects. Let's use this patch > instead of the hack. lets do both, checking the existence of an attribute before accessing this attribute is not a hack i my opinion
*** Bug 47149 has been marked as a duplicate of this bug. ***
*** Bug 46093 has been marked as a duplicate of this bug. ***
A possible cause is Bug #31317. (In reply to Felix Botner from comment #9) > (In reply to Florian Best from comment #8) > > Created attachment 9833 [details] > > patch > > > > This error might happen if the objects have references which don't exists, > > e.g. policies / groups / etc. > > > > I attached a patch, which ignores those objects. Let's use this patch > > instead of the hack. > > lets do both, > > checking the existence of an attribute before accessing this attribute is > not a hack i my opinion I don't think so. My patch is sufficient and prevents all possible causes of this error. There is no need to check for the existence of the attribute anymore.
Patch has been applied. univention-directory-reports.yaml 7c376671bd7e | YAML Bug #47922 83a4e1b41059 | Bug #47922: fix creating reports for objects having broken references univention-directory-reports (11.0.0-2) 83a4e1b41059 | Bug #47922: fix creating reports for objects having broken references
Verified: * Code review * Can create reports of objects which have references that don't exist. * Advisory
<http://errata.software-univention.de/ucs/4.4/1.html>