Univention Bugzilla – Bug 54064
UDM REST API does not handle nagios/service objects - HTTP 500 - RuntimeError: Object was not opened
Last modified: 2022-11-16 18:03:56 CET
When opening a nagios/service object in the UDM REST API a HTTP 500 is returned. The traceback in the response and log file is: 15.11.21 16:04:06 ERROR ( 1681) : Uncaught exception GET /udm/nagios/service/cn=UNIVENTION_DISK_ROOT,cn=nagios,dc=uni,dc=dtr (0.0.0.0) HTTPServerRequest(protocol='http', host='10.200.3.31', method='GET', uri='/udm/nagios/service/cn=UNIVENTION_DISK_ROOT,cn=nagios,dc=uni,dc=dtr', version='HTTP/1.1', remote_ip='0.0.0.0') Traceback (most recent call last): File "/usr/lib/python3/dist-packages/tornado/web.py", line 1592, in _execute result = yield result File "/usr/lib/python3/dist-packages/tornado/gen.py", line 1133, in run value = future.result() File "/usr/lib/python3/dist-packages/tornado/gen.py", line 1147, in run yielded = self.gen.send(value) File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 2622, in get self.set_entity_tags(obj) File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 2688, in set_entity_tags self.set_header('Etag', self.get_etag(obj)) File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 2697, in get_etag raise RuntimeError('Object was not opened!') RuntimeError: Object was not opened! 15.11.21 16:04:06 ERROR ( 1681) : 500 GET /udm/nagios/service/cn=UNIVENTION_DISK_ROOT,cn=nagios,dc=uni,dc=dtr (0.0.0.0) 14.06ms ERROR:tornado.access:500 GET /udm/nagios/service/cn=UNIVENTION_DISK_ROOT,cn=nagios,dc=uni,dc=dtr (127.0.0.1) 22.69ms
Problem does not exist in 4.4.
It looks like a UDM error. This patch should fix it?!: diff --git management/univention-directory-manager-modules/modules/univention/admin/handlers/nagios/service.py management/univention-directory-manager-modules/modules/univention/admin/handlers/nagios/service.py index 537c87498a..c55c48c42b 100644 --- management/univention-directory-manager-modules/modules/univention/admin/handlers/nagios/service.py +++ management/univention-directory-manager-modules/modules/univention/admin/handlers/nagios/service.py @@ -247,6 +247,7 @@ class object(univention.admin.handlers.simpleLdap): return info def open(self): + super(object, self).open() _re = re.compile(r'^([^.]+)\.(.+?)$') # convert host FQDN to host DN hostlist = []
Above patch make nagios/service work. I navigated through the web interface there and retrived the list of all nagios/service objects without an error: 17.11.21 16:37:29 INFO ( 32092) : 200 GET /udm/ (0.0.0.0) 556.00ms 17.11.21 16:37:31 INFO ( 32092) : 200 GET /udm/navigation/ (0.0.0.0) 85.48ms 17.11.21 16:37:39 INFO ( 32092) : 200 GET /udm/nagios/service/ (0.0.0.0) 19.73ms 17.11.21 16:37:41 INFO ( 32092) : 200 GET /udm/nagios/service/?position=&hidden=1&property=&query%5B%5D=*&page=1&limit=0&by=&dir=ASC (0.0.0.0) 126.24ms
Reproducer: curl -H 'Accept: application/json' http://Administrator:univention@localhost/univention/udm/nagios/service/cn%3DUNIVENTION_RAID%2Ccn%3Dnagios%2C"$(ucr get ldap/base)"
The missing open() super call has been added. univention-directory-manager-modules.yaml 854c4daca2db | fix(udm nagios/service): fix missing call to super `open()` in `nagios/service` univention-directory-manager-modules (15.0.13-15) 854c4daca2db | fix(udm nagios/service): fix missing call to super `open()` in `nagios/service`
Verified: * Comment 4 * Advisory * ucs-test-udm-rest
<https://errata.software-univention.de/#/?erratum=5.0x489>