Bug 32743 - UCR Python API for setting and unsetting UCRVs
UCR Python API for setting and unsetting UCRVs
Status: CLOSED FIXED
Product: UCS extended documentation
Classification: Unclassified
Component: Developer documentation
unspecified
All Linux
: P5 normal (vote)
: UCS 4.0-1-errata
Assigned To: Philipp Hahn
Dirk Wiesenthal
: interim-2
: 32722 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-30 09:23 CEST by Moritz Muehlenhoff
Modified: 2014-07-29 13:01 CEST (History)
3 users (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): API change
Max CVSS v3 score:


Attachments
Update for ucr_update() (2.51 KB, patch)
2014-03-17 15:54 CET, Philipp Hahn
Details | Diff
Update for ucr_update() v2 (6.68 KB, patch)
2014-03-17 16:26 CET, Philipp Hahn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Muehlenhoff univentionstaff 2013-09-30 09:23:50 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.
  """
Comment 1 Philipp Hahn univentionstaff 2014-03-17 15:54:38 CET
Created attachment 5831 [details]
Update for ucr_update()
Comment 2 Philipp Hahn univentionstaff 2014-03-17 16:26:23 CET
Created attachment 5832 [details]
Update for ucr_update() v2

Fix email and SVN links.
Comment 3 Stefan Gohmann univentionstaff 2014-03-17 20:30:06 CET
*** Bug 32722 has been marked as a duplicate of this bug. ***
Comment 5 Dirk Wiesenthal univentionstaff 2014-06-06 09:52:53 CEST
from univention.config_registry.handler import ucr_update
ImportError: cannot import name ucr_update

->
from univention.config_registry import handler_update # ?
Comment 6 Dirk Wiesenthal univentionstaff 2014-06-06 09:54:10 CEST
BTW: svn links have changed again
Comment 7 Philipp Hahn univentionstaff 2014-06-06 10:16:25 CEST
(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)
Comment 8 Dirk Wiesenthal univentionstaff 2014-06-06 12:13:37 CEST
Ok
Comment 10 Dirk Wiesenthal univentionstaff 2014-07-29 13:01:01 CEST
I do not see this paragraph online... Would have liked to point an App Center partner to this paragraph.