Bug 55559 - UCR type check failure should inform about type of the variable
UCR type check failure should inform about type of the variable
Status: NEW
Product: UCS
Classification: Unclassified
Component: UCR
UCS 5.0
Other Linux
: P5 minor (vote)
: ---
Assigned To: UCS maintainers
UCS maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2023-01-11 17:03 CET by Ingo Steuwer
Modified: 2023-01-12 14:37 CET (History)
2 users (show)

See Also:
What kind of report is it?: Feature Request
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): bitesize
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Steuwer univentionstaff 2023-01-11 17:03:17 CET
If type checking in UCR is activated (ucr/check/type='yes'), variables can't be changed anymore if the new value does not match the configured type.

The error message is too generic, as it gives no hint which type or values are expected.

Example:

# ucr set directory/manager/rest/debug/level=DEBUG
Create directory/manager/rest/debug/level
E: Value 'DEBUG' incompatible for 'directory/manager/rest/debug/level'

Expectation would be to at least print the configured type, in the example "int".

I consider this as a minor bug (and not an enhancement). as it makes the usage of the feature very "user-unfriendly".
Comment 1 Philipp Hahn univentionstaff 2023-01-11 20:37:20 CET
While this might work for simpl `Type={[ui]int,portnumber,bool,ip[v{4,6}]address,url_{http,proxy}}`, it will not work for `Type=str` as soon as it is combined with `Regex=…` or `Type=int` with arbitrary `Min=…` / `Max=…`: The current format was chosen at it is easy to validate by a machine, but a human might have a hard time to parse it.

This was already discussed as part of the implementation of Bug #54495 and we decided to have such human readable description as part the the UCRV description:

> $ ucr info directory/manager/rest/debug/level
> directory/manager/rest/debug/level: 2
> The verbosity of log messages in /var/log/univention/directory-manager-rest.log. Possible values: 0-4/99 (0: only error messages to 4: all debug statements, with = 99 sensitive data like cleartext passwords is logged as well).

See https://git.knut.univention.de/univention/ucs/-/blob/5.0-2/base/univention-config-registry/python/univention/config_registry/validation.py for all currently implemented types.
Comment 2 Ingo Steuwer univentionstaff 2023-01-12 14:37:30 CET
mhm, I don't get the argumentation. A written explanation in the description is very good, but for me the "hard facts" of the configured type are something different.

The example you gave is a good one here: "Possible values: 0-4/99" -> I'm unsure what "4/99" means here, it could be:
- only 0,1,2,3,4 and 99 are valid
- sometimes 0-4 and sometimes 0-99, it depends 
- 0-0.0404 (which is 4/99) -- well, ok, obviously not ;-)
- ...

And the main point isn't addressed: if setting a variable fails I need to know that "ucr info" gives me more information. At least a hint on that could be written in the error message. And I strongly vote to print the "Type" too -- my wild guess is that if will explain the error in >90% of the time.