Univention Bugzilla – Bug 55559
UCR type check failure should inform about type of the variable
Last modified: 2023-01-12 14:37:30 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".
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.
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.