Univention Bugzilla – Bug 26774
Hooks für Online-Update-Modul
Last modified: 2012-07-20 15:24:46 CEST
+++ This bug was initially created as a clone of Bug #26585 +++ Das Online-Update-Modul sollte die Möglichkeit bieten, über Hooks - auf der "Startseite" des Module beliebige Meldungen anzuzeigen - das Online-Update-Modul zu sperren In UCS 2.4 war dieses Feature im Onlineupdatemodul bereits vorhanden.
The Online Update Module supports the following hooks which are called once at module startup: - updater_show_message - updater_prohibit_update These hooks may reside within a single python file that has to be placed in the directory /usr/share/pyshared/univention/management/console/modules/updater/hooks/ The content of an example hookfile is placed below. Hook "updater_show_message" =========================== This hook is called to allow 3rd party software to display messages within the Online Update Module. The returned message will be displayed in a separate TitlePane for each hook. This hook has to return a python dictionary: Key | Typ | Description ===========|=========|======================================================== 'valid' | Boolean | Indicates if this hooks wants to display a message | | All other keys have to be set, if this value is set | | to True. (REQUIRED) -----------|---------|-------------------------------------------------------- 'title' | String | title of displayed TitlePane (OPTIONAL) -----------|---------|-------------------------------------------------------- 'message' | String | content of TitlePane (OPTIONAL) -----------|---------|-------------------------------------------------------- Hook "updater_prohibit_update" ============================== This hook is called to allow 3rd party software to block further updates. Please use this feature only if the update would fail or break the system otherwise. ach hook has to return a Boolean. If at least one hook returns the value True, the update related TitlePanes will not be displayed to the user. Example myhook.py ================= def my_func1(*args, **kwargs): return { 'valid': True, 'title': 'The Title Of The TitlePane', 'message': '<p>The content of the <b>TitlePane</b></p>' } def my_func2(*args, **kwargs): return True def register_hooks(): return [ ('updater_show_message', my_func1), ('updater_prohibit_update', my_func2)] Quelle: http://wiki.univention.de/index.php?title=Hooks_in_Online_Update_Module univention-updater (7.0.157-1) unstable; urgency=low Changelogeintrag wurde vorgenommen.
OK, funktioniert, getestet mit einm OXASE und folgendem Hook __package__='' # workaround for PEP 366 def updater_show_message(*args, **kwargs): result = {} result['valid'] = True result['title'] = "new message" result['message'] = "my new message" return result def my_func2(*args, **kwargs): return True def register_hooks(): return [ ('updater_show_message', updater_show_message), ('updater_prohibit_update', my_func2) ] Changelog Eintrag vorhanden.
UCS 3.0-2 has been released: http://forum.univention.de/viewtopic.php?f=54&t=1905 If this error occurs again, please use "Clone This Bug".