Univention Bugzilla – Bug 56051
fix(udm-rest-server): pass debug level from CLI to child processes
Last modified: 2023-05-24 15:43:42 CEST
When starting the UDM REST server and explicitly setting the debug level on the cli (e.g. `-d 2`), the debug level is not passed on to the subprocesses. Instead, the child processes attempt to read the value from the UCR and use this instead. We encountered this issue when running the containerized UDM REST server, which had explicitly set the `-d` flag on startup, but it was missing the UCR entry. In this case the subprocesses would try to set the log level to `None` (but were expecting an `int`) and failed to start. # Steps to reproduce 1. Stop the UDM REST server if it is running. 2. Unset `directory/manager/rest/debug/level` in UCR. 3. Start the server again: `python3 -m univention.admin.rest.server -d 4 -p 9979 -i 0.0.0.0 -c 0` # What is the current bug behavior? The child processes will not start: ``` 09.05.23 14:30:17 INFO ( 88) : Started child 29 09.05.23 14:30:18.563 DEBUG_INIT Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/lib/python3/dist-packages/univention/admin/rest/__main__.py", line 219, in <module> Server.main() File "/usr/lib/python3/dist-packages/univention/admin/rest/__main__.py", line 215, in main server.run(args) File "/usr/lib/python3/dist-packages/univention/admin/rest/__main__.py", line 77, in run log_init('/dev/stdout', args.debug, args.processes != 1) File "/usr/lib/python3/dist-packages/univention/management/console/log.py", line 87, in log_init log_set_level(log_level) File "/usr/lib/python3/dist-packages/univention/management/console/log.py", line 104, in log_set_level ud.set_level(component, level) TypeError: an integer is required (got type NoneType) ``` # What is the expected correct behavior? Server starts with no error messages.
Merged the MR from Thomas: univention-directory-manager-rest.yaml 2567453591d8 | chore(univention-directory-manager-rest): update advisory f6a8f1fd7b16 | fix(udm-rest-server): pass debug level from CLI to child processes univention-directory-manager-rest (10.0.6-3) f6a8f1fd7b16 | fix(udm-rest-server): pass debug level from CLI to child processes
REOPEN: the fix breaks UDM REST API completely: 16.05.23 16:42:37 INFO ( 30137) : stopping children: [] 16.05.23 16:42:37 INFO ( 30137) : stopping subprocesses: [] Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/lib/python3/dist-packages/univention/admin/rest/server/__main__.py", line 41, in <module> Gateway.main() File "/usr/lib/python3/dist-packages/univention/admin/rest/server/__init__.py", line 217, in main cls.start_processes(args.processes, args.port, args.debug) File "/usr/lib/python3/dist-packages/univention/admin/rest/server/__init__.py", line 292, in start_processes cls.PROCESSES[language] = subprocess.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr) File "/usr/lib/python3.7/subprocess.py", line 775, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.7/subprocess.py", line 1453, in _execute_child restore_signals, start_new_session, preexec_fn) TypeError: expected str, bytes or os.PathLike object, not int
univention-directory-manager-rest (10.0.6-3) 0a6260bbc98e | fixup! fix(udm-rest-server): pass debug level from CLI to child processes
OK: YAML OK: changes
<https://errata.software-univention.de/#/?erratum=5.0x673>