Univention Bugzilla – Bug 32743
UCR Python API for setting and unsetting UCRVs
Last modified: 2014-07-29 13:01:01 CEST
+++ This bug was initially created as a clone of Bug #32544 +++ UCR currently only exports the command-line functions "handler_set" and "handler_unset" to set and unset UCR variables from within a Python program. 1. handler_set() expects a list of strings of the form "key=value" or "key?value", which is used on the command-line. This is not very pythonic. 2. Combining a set with an unset is currently not possible, which is for example required for re-configuring the network, since the interface.py handler is called after each change and restarts the network. Add a new Python function to apply changes to UCR: ucr_update(ucr, changes): """ Apply all changes to the UCR. :ucr: An ConfigRegistry instance, which gets reloaded and saved. :changes: A dictionary, which maps UCRV-names to there new value or to None to unset them. """
Created attachment 5831 [details] Update for ucr_update()
Created attachment 5832 [details] Update for ucr_update() v2 Fix email and SVN links.
*** Bug 32722 has been marked as a duplicate of this bug. ***
r48741, <http://jenkins.knut.univention.de:8080/job/UCS-3.2%20Handbook%20Developer/ws/webroot/developer-reference-3.2.html#ucr:usage:python>
from univention.config_registry.handler import ucr_update ImportError: cannot import name ucr_update -> from univention.config_registry import handler_update # ?
BTW: svn links have changed again
(In reply to Dirk Wiesenthal from comment #5) > from univention.config_registry.handler import ucr_update > ImportError: cannot import name ucr_update No: "handler" -> "frontent" r50912 | Bug #32743 DevDoc: Fix ucr_update module (In reply to Dirk Wiesenthal from comment #6) > BTW: svn links have changed again r50913 | Bug #32743 DevDoc: Fix SVN links (again)
Ok
http://docs.univention.de/developer-reference-3.2.html#ucr:usage:python
I do not see this paragraph online... Would have liked to point an App Center partner to this paragraph.