Bug 53742 - Internet rule "Unbeschränkt" is not set up
Internet rule "Unbeschränkt" is not set up
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UCR
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-0-errata
Assigned To: Florian Best
Johannes Keiser
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-09-02 18:24 CEST by Florian Best
Modified: 2024-02-23 13:44 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): Regression
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2021-09-02 18:24:26 CEST
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).
Comment 2 Florian Best univentionstaff 2021-09-02 18:26:07 CEST
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
Comment 3 Philipp Hahn univentionstaff 2021-09-03 09:53:44 CEST
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.
Comment 4 Florian Best univentionstaff 2021-09-06 19:37:01 CEST
(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
^^
Comment 5 Florian Best univentionstaff 2021-09-07 10:14:46 CEST
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.
Comment 6 Florian Best univentionstaff 2021-09-08 13:15:19 CEST
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
Comment 7 Florian Best univentionstaff 2021-09-10 16:28:10 CEST
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
Comment 8 Johannes Keiser univentionstaff 2021-09-13 10:37:15 CEST
OK: umlauts can be used in ucr keys
OK: "Unbeschränkt" internet rule is created on installation again
OK: yaml
-> verified
Comment 9 Erik Damrose univentionstaff 2021-09-15 17:41:56 CEST
<https://errata.software-univention.de/#/?erratum=5.0x88>