Univention Bugzilla – Bug 52846
UCR Scripts: stdin is not populated if old or new is None
Last modified: 2021-02-25 09:38:31 CET
You may define scripts that are triggered when a UCRV changes. The documentation says, it is called with argv[1] == "generate" and stdin.read() == """key1@%@old@%@new key2@%@old@%@new key3@%@old@%@new""" But this is just empty if the variables are unset or were unset. On a side note, I do not think that passing variables that are not defined in the script definition is correct. Currently, if you just say: Type: script Script: my_script Variables: key1 And then do ucr set key1=x key2=y you get key1 and key2, although key2 is unrelated to the script. Otherwise one would have specified it.
In stdin, you cannot differentiate between None and "". But we could add a note in the dev documentation and just pass "". The script dev has to decide how to handle "". Using a completely different format (not @%@) for these cases would be over complicated, I think.
Please write a proper Python module instead of using a UCR Script: The latest is quiet limited and the API cannot be changed for Script without breaking already existing Scripts. Realistically: WONTFIX