Bug 26774 - Hooks für Online-Update-Modul
Hooks für Online-Update-Modul
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Software update
UCS 3.0
Other Linux
: P5 enhancement (vote)
: UCS 3.0-2
Assigned To: Sönke Schwardt-Krummrich
Felix Botner
: interim-1
Depends on: 26585
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-12 11:34 CEST by Sönke Schwardt-Krummrich
Modified: 2012-07-20 15:24 CEST (History)
1 user (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
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 Sönke Schwardt-Krummrich univentionstaff 2012-04-12 11:34:41 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.
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2012-04-13 15:50:38 CEST
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.
Comment 2 Felix Botner univentionstaff 2012-06-20 17:15:16 CEST
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.
Comment 3 Stefan Gohmann univentionstaff 2012-07-20 15:24:46 CEST
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".