Univention Bugzilla – Bug 32544
UCR Python API for setting and unsetting UCRVs
Last modified: 2013-11-19 06:43:49 CET
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. """
Please note: Bug #30128 requests an API change in the last paragraph when unsetting variables, which is implemented: Instead of new_value='' the Python-handler no gets new_value=None in the changes-dictionary. A review of our standard and the OX/Zarafa handlers shows, that they should be unaffected. UCR-Scripts are not affected by this change because of Bug #32570. r43992 | Bug #32544: UCR: Implement new update function r43991 | Bug #32544: UCR: Refacture common update code r43990 | Bug #32544: UCR: Refacture common scope parsing r43989 | Bug #32544: UCR: Simplify replog r43988 | Bug #32544: UCR: Make scope visible r43987 | Bug #32544: UCR: Add context wrapper r43986 | Bug #32544: UCR: Rename 'reg' to 'ucr' r43985 | Bug #32544: UCR: Minor code cleanup r43984 | Bug #32544: UCR: Add unit test r43983 | Bug #28670: UCR: Ignore empty interface settings r43993 | Bug #32544: UCR: Undo r43985 univention-config-registry_9.0.4-2.440.201309130953 ChangeLog: r43993 A new function was added to the Python API set and unset &ucsUCRV;s atomically through a disctionary
*** Bug 26819 has been marked as a duplicate of this bug. ***
Review code changes: OK Test new "update" function: OK interfaces.py ignores UCRV set to empty string: OK Changelog: OK
UCS 3.2 has been released: http://docs.univention.de/release-notes-3.2-en.html http://docs.univention.de/release-notes-3.2-de.html If this error occurs again, please use "Clone This Bug".