Univention Bugzilla – Bug 53742
Internet rule "Unbeschränkt" is not set up
Last modified: 2024-02-23 13:44:02 CET
The postinst of ucs-school-webproxy says: Please fix invalid umlaut in config variable key. Reloading apache Not updating proxy/filter/setting/Kein Internet/filtertype Please fix invalid umlaut in config variable key "proxy/filter/setting/Unbeschränkt/filtertype" to proxy/filter/setting/Unbeschraenkt/filtertype. Not setting proxy/filter/setting/Unbeschränkt/filtertype Please fix invalid umlaut in config variable key "proxy/filter/setting/Unbeschränkt/wlan" to proxy/filter/setting/Unbeschraenkt/wlan. Not setting proxy/filter/setting/Unbeschränkt/wlan Not updating proxy/filter/global/blacklists/forced Why is the postinst then not failing? Why is the variable set in postinst? Let's move it into a joinscript and let it fail if UCR fails. The only test case which covered this by accident was 91_ucsschool-selenium/02_internet_rules. See also git:cd8822019552fe8ffade10bf5a6861c73a1c4436 (and git:201135c9a47964cc0731eaf3a67a276ba60c7b46).
UCR doesn't fail at all: # univention-config-registry set proxy/filter/setting/Unbeschränkt/filtertype?blacklist-pass Please fix invalid umlaut in config variable key "proxy/filter/setting/Unbeschränkt/filtertype" to proxy/filter/setting/Unbeschraenkt/filtertype. Not setting proxy/filter/setting/Unbeschränkt/filtertype # echo $? 0
UCR is lenient and just ignores invalid variables. We should not change this behavior as it can break other cases. (API change) We can add a `--strict` option to enable strict mode, where all UCRV are validated **before** they are applied and abort if validation failes.
(In reply to Philipp Hahn from comment #3) > UCR is lenient and just ignores invalid variables. UCR was lenient. > We should not change this behavior as it can break other cases. (API change) The API is already changed in UCS 5.0 > We can add a `--strict` option to enable strict mode, where all UCRV are > validated **before** they are applied and abort if validation failes. We don't need --strict, we need the behavior of UCS 4 back in UCS 5. (In reply to Florian Best from comment #2) > Not setting proxy/filter/setting/Unbeschränkt/filtertype ^^
Python 2: >>> from univention.config_registry.misc import replace_umlaut >>> replace_umlaut(u'proxy/filter/setting/Unbeschränkt/filtertype2') u'proxy/filter/setting/Unbeschraenkt/filtertype2' >>> replace_umlaut(b'proxy/filter/setting/Unbeschränkt/filtertype2') 'proxy/filter/setting/Unbeschr\xc3\xa4nkt/filtertype2' Python 3: >>> from univention.config_registry.misc import replace_umlaut >>> replace_umlaut('proxy/filter/setting/Unbeschränkt/filtertype2') 'proxy/filter/setting/Unbeschraenkt/filtertype2' → The replace_umlaut() function did only work with unicode strings in Python 2 / UCS 4.4 but it always got bytestrings via CLI.
UCR handler can now set an exit code != 0. As the handlers might be generator functions I could not solve this via a simple return, so I used the options argument dictionary for this. The handler_set() now sets the exit code if one of the variable keys are invalid. The handler_set() allows keys with umlauts again, as in UCS 4.4. univention-config-registry.yaml da034130c929 | YAML Bug #53742 univention-config-registry (15.0.7-9) da034130c929 | YAML Bug #53742 767c643c18a1 | Bug #53742: fail handler_set() if invalid UCR keys are specified 005b487fafa4 | Bug #53742: allow UCR handler to set exit code 2713354ee871 | Bug #53742: allow umlauts again in UCR keys, as in UCS 4.4
Johannes wanted that the warning message doesn't sound like an error: - print('Please fix invalid umlaut in config variable key "%s" to %s.' % (old, key), file=out) + print('Umlauts in config variable key are not recommended. Please consider renaming "%s" to %s.' % (old, key), file=out) univention-config-registry (15.0.7-9) e04dbc7cccd8 | Bug #53742: make warning message sound more soften
OK: umlauts can be used in ucr keys OK: "Unbeschränkt" internet rule is created on installation again OK: yaml -> verified
<https://errata.software-univention.de/#/?erratum=5.0x88>