Univention Bugzilla – Bug 29420
Entwicklung eines Listener-Moduls
Last modified: 2015-02-19 15:02:40 CET
Die 3.1-0 Version der Developer-Dokumentation sollte auf Basis des Artikels http://wiki.univention.de/index.php?title=Entwicklung_von_Univention_Directory_Listener-Modulen erstellt werden. Anschließend kann er entfernt werden oder ein Verweis auf die Entwickler-Doku eingefügt werden. Das Beispielmodul sollte am besten ins öffentliche SVN kopiert werden, damit es leicht ausgecheckt werden kann.
*** Bug 7662 has been marked as a duplicate of this bug. ***
*** Bug 22101 has been marked as a duplicate of this bug. ***
That bug can be closed? http://docs.univention.de/developer-reference-3.1.html#chap:listener Or is there anything missing?
(In reply to Moritz Muehlenhoff from comment #3) > That bug can be closed? No > http://docs.univention.de/developer-reference-3.1.html#chap:listener > > Or is there anything missing? Yes
r47537+r47538 QA neede: 1. comare internals with <https://hutten.knut.univention.de/mediawiki/index.php/Arvid_memo/Listener> 2. Remove Wiki page after QA and publish.
An app vendor is currently working on a listener module and the updated documentation would be really helpful for them. I'd like to point him to the documenation as soon as possible and as soon as it is available.
(In reply to Nico Gulden from comment #6) > An app vendor is currently working on a listener module and the updated > documentation would be really helpful for them. I'd like to point him to the > documenation as soon as possible and as soon as it is available. Can they read German? If so please use: http://wiki.univention.de/index.php?title=Entwicklung_von_Univention_Directory_Listener-Modulen
(In reply to Stefan Gohmann from comment #7) > (In reply to Nico Gulden from comment #6) > > An app vendor is currently working on a listener module and the updated > > documentation would be really helpful for them. I'd like to point him to the > > documenation as soon as possible and as soon as it is available. > > Can they read German? If so please use: > http://wiki.univention.de/index. > php?title=Entwicklung_von_Univention_Directory_Listener-Modulen Yes, they can. I forwarded it. QA is not urgent anymore for me. Thanks.
Created attachment 5859 [details] qa_29420.patch Please find some small change proposals attached.
(In reply to Arvid Requate from comment #9) > Created attachment 5859 [details] > qa_29420.patch > > Please find some small change proposals attached. Applied with some small changes: array -> list Listener -> listener (some more cases) automatically internally configured -> configured internally should be -> is cache to cache -> cache to store Split long sentence: > It's best practice to use the <function>handler()</function> only to process the stream of changes, set UCR variables or generate new configuration files. > Restarting associated services should be delayed to the <function>postrun()</function> function. Additional changes: 1. Remove the ':' between ldap/server/addition and the closing ')'. 2. Tag all variables and functions as either "required" or "optional". (actually "filter" is optional, but will be evaluated is False always. And the listener will crash, is handler() is not defined.) 3. Move the "debian/printusers.postrm" line between the two source code examples to better separate them for readability. Regarding Listener&pickle: > AREQ: And what's the recommendation? Currently you can't write pickle files from a listener module and read them from a non-listener program (I tried to do that once for a customer module, only to discover that later which forced me to re-write the whole module). Writing pickle data and reading pickle from the same listener module should work. Regarding writing files to /tmp/ as root: > AREQ: Why? What's the point here? Relevant? The module does something problematic here to keep the example simple. Most listener modules used in UCS seem to simply do the seteuid() thing to by-pass the permission checking, since they easily could live with files owned by "listener" instead of "root". I actually tried to implement such a listener, but there are several pit-falls, as for example, the module is initialized with euid=root; so if you already create a file/directory there, the module will not be able to access it later on from its handler(), as there euid=listener. So you have to explicitly change the owner of the initial file/directory by hand, using some combination of os.chown(path, pwd.getpwnam("listener").pw_uid), -1) Since there's also no code to prevent symlink attacks , I at least want't to tell the reader that "this is bad style to write as root into a public location". I've removed the paragraph and changed the path to /root/UserList.txt Regarding LDAP returning nothing: > AREQ: Uh, really? A d operation should be processed as well? Maybe rephrase "the process"? You are right and I was wrong, now reads: > It retrieve the latest state of the object identified through the <abbrev>DN</abbrev>. > If access is blocked, for example, by <firstterm>selective replication</firstterm>, the change is handled as a delete operation instead. r49143: <http://jenkins.knut.univention.de:8080/view/Doku/job/UCS-3.2%20Handbook%20Developer/ws/webroot/developer-reference-3.2.html#chap:listener>
r49153: more QA fixed from round 2 <http://jenkins.knut.univention.de:8080/job/UCS-3.2%20Handbook%20Developer/103/artifact/webroot/developer-reference-3.2.html#chap:listener>
r49159: Replace wrong reference to ldap/server/addition and document notifier choosing mechanism. <http://jenkins.knut.univention.de:8080/job/UCS-3.2%20Handbook%20Developer/104/artifact/webroot/developer-reference-3.2.html#listener:details:internal>
Ok, looks good, high information quality.
r49217: Fixed several issues in the printuser.py example, which was originally copied from the Wiki article.
As previously discussed: a listener MUST NOT use command only, but should still prefer checking "new" and "old" for "None" or "{...}". r49798 | Bug #29420 DevDoc: Listener example
Ok.
http://docs.univention.de/developer-reference-4.0.html#chap:listener