Univention Bugzilla – Bug 48357
listener modules created with new listener API always displayed with status=0
Last modified: 2019-08-19 16:08:42 CEST
Created attachment 9779 [details] simple listener module When a listener module created with the new listener API is installed and the u-d-l is restarted the status shown with "univention-directory-listener-ctrl status" is always "0". The listener did however successfully initialize the module, as can be seen in the logfile. The status file in /var/lib/univention-directory-listener/handlers/$NAME does contain a "3", but "univention-directory-listener-ctrl status" still shows a "0". Attached is a simple listener module to reproduce this.
<http://docs.software-univention.de/developer-reference-4.3.html#listener:handler> specified that "name" must be declared as the top-level symbol in the *Python* module. This is parsed by the *shell* script "management/univention-directory-listener/src/listener-ctrl", which uses the regular expression ^name\s*=\s*['\"]([^'\"]+)['\"]\s*(#.*)?$ Using anything else breaks the status output.
I created a script that prints the configuration of both new and old API listener modules. Because the old way is must faster (no Python import required), it is only used as a fall back. [dtroeder/48357_listener_name 3b8a94241c] Bug #48357: get name of listener modules using new API
Alternative: $ apt install pcre2-utils $ pcre2grep -M -o3 "ListenerModuleHandler\).*(\n|.)*class Configuration.*(\n|.)*name\s*=\s*[\"'](.+)[\"']" <LISTENERMODULE> Tested with * univention-radius.py * /usr/share/doc/univention-directory-listener/examples/listener_module_template.py