Bug 52846 - UCR Scripts: stdin is not populated if old or new is None
UCR Scripts: stdin is not populated if old or new is None
Status: NEW
Product: UCS
Classification: Unclassified
Component: UCR
UCS 5.0
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS maintainers
UCS maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-02-24 20:43 CET by Dirk Wiesenthal
Modified: 2021-02-25 09:38 CET (History)
2 users (show)

See Also:
What kind of report is it?: Development Internal
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 Dirk Wiesenthal univentionstaff 2021-02-24 20:43: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.
Comment 1 Dirk Wiesenthal univentionstaff 2021-02-24 21:01:50 CET
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.
Comment 2 Philipp Hahn univentionstaff 2021-02-25 09:38:31 CET
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