Bug 53513 - [4.4] Traceback when fetching OpenAPI schema from UDM REST API
[4.4] Traceback when fetching OpenAPI schema from UDM REST API
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM - REST API
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 4.4-9-errata
Assigned To: Florian Best
Jürn Brodersen
https://git.knut.univention.de/univen...
:
Depends on: 50648
Blocks:
  Show dependency treegraph
 
Reported: 2021-06-24 15:45 CEST by Daniel Tröder
Modified: 2022-08-17 17:18 CEST (History)
6 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 4: A User would return the product
User Pain: 0.114
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support: Yes
Flags outvoted (downgraded) after PO Review:
Ticket number: 2021062321000322
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2021-06-24 15:45:02 CEST
A customer wants to use the Kelvin API and when it is installed, when downloading the OpenAPI schema from 'https://FQDN/univention/udm/openapi.json':

-----------------------------------------------------------------------------------------
23.04.21 06:31:58       ERROR      (    25121) : Uncaught exception GET /udm/openapi.json (0.0.0.0)
    HTTPServerRequest(protocol='http', host='redacted.intranet', method='GET', uri='/udm/openapi.json', version='HTTP/1.1', remote_ip='0.0.0.0', headers={'X-Umc-Https': 'on', 'Via': '1.1 redacted.intranet', 'Accept-Enco
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/tornado/web.py", line 1467, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/usr/lib/python2.7/dist-packages/univention/admin/rest/module.py", line 1455, in get
        model_properties[name] = codec.get_openapi_definition()
      File "/usr/lib/python2.7/dist-packages/univention/admin/types.py", line 212, in get_openapi_definition
        return dict((key, value) for key, value in self.openapi_definition().items() if value is not None and value not in (float('inf'), -float('inf')))
      File "/usr/lib/python2.7/dist-packages/univention/admin/types.py", line 484, in openapi_definition
        definition['items'] = self.item_type(self.property, self.property_name).get_openapi_definition()
      File "/usr/lib/python2.7/dist-packages/univention/admin/types.py", line 212, in get_openapi_definition
        return dict((key, value) for key, value in self.openapi_definition().items() if value is not None and value not in (float('inf'), -float('inf')))
      File "/usr/lib/python2.7/dist-packages/univention/admin/types.py", line 551, in openapi_definition
        items = [item.get_openapi_definition() for item in self.item_types]
    TypeError: 'NoneType' object is not iterable
-----------------------------------------------------------------------------------------

This will probably be fixed by backporting (from 5.0 to 4.4) a fix done in the scope of Bug #50648 (git:99599bc903933afd75215cf33594171f44190223).
Comment 3 Ingo Steuwer univentionstaff 2021-09-10 11:48:18 CEST
This is fixed in the upcoming release of UCS@school for UCS 5.0.
Comment 13 Jürn Brodersen univentionstaff 2022-08-15 11:49:28 CEST
Sorry that it took so long :(

This can be merged.

I wasn't sure how to reproduce this, so I ended up writing a test:
[5.0-2 3bd28e1457] Bug #53513: Test OpenAPI schema for complex syntax

I only added it to 5.0-2 but you can use it for 4.4-9 as well if you want to. Just replace "pytest-3" with "pytest"
Comment 14 Florian Best univentionstaff 2022-08-15 12:36:50 CEST
Code has been backported:

Package: univention-directory-manager-modules
Version: 14.0.20-32A~4.4.0.202208151214

univention-directory-manager-modules.yaml
d6f4acc07c87 | Bug #53513: fix types definition for complex syntaxes without subsyntax_key_value

univention-directory-manager-modules (14.0.20-32)
d6f4acc07c87 | Bug #53513: fix types definition for complex syntaxes without subsyntax_key_value
Comment 15 Jürn Brodersen univentionstaff 2022-08-16 09:53:44 CEST
What I tested:

Added a new complex syntax to users/user (see 73_udm-rest/03_complex_syntax_type.py)-> No more crash -> OK
  ComplexMultiValueKeyValueDictType -> OK
  ComplexMultiValueDictType -> OK
  ComplexListType (The one that was broken) -> OK

jenkins -> OK
yaml -> OK