Univention Bugzilla – Bug 35239
UCR modules and handlers are double-registered and double-executed
Last modified: 2018-12-06 15:24:01 CET
The WebWeaver integration packet contains an UCR module, which is registered using univention-install-config-registry. If the package is re-installed due to an upgrade, the handler is then double-registered and gets called two times: # ucr unset webweaver/foobar/ServerPasswd Unsetting webweaver/foobar/ServerPasswd Module: univention-digionline-webweaver WebWeaver: Handling changes: {'webweaver/foobar/ServerPasswd': ('41dff51b237d4961963f0cd12823a6b4', None)} WebWeaver: Writing new configuration file "/etc/univention-digionline-webweaver.json"... Module: univention-digionline-webweaver WebWeaver: Handling changes: {'webweaver/foobar/ServerPasswd': ('41dff51b237d4961963f0cd12823a6b4', None)} WebWeaver: Writing new configuration file "/etc/univention-digionline-webweaver.json"... # ucr update # python -c 'import pickle;f=open("/var/cache/univention-config/cache");f.readline();d=pickle.load(f);print [_.module for _ in d["^webweaver/"]]' ['univention-digionline-webweaver'] # ucr register univention-digionline-webweaver # python -c 'import pickle;f=open("/var/cache/univention-config/cache");f.readline();d=pickle.load(f);print [_.module for _ in d["^webweaver/"]]' ['univention-digionline-webweaver', 'univention-digionline-webweaver']
Created attachment 5988 [details] Fix hashing to prevent double registration May breaks if a script and/or module and/or file handler exists with the same name.
*** Bug 39443 has been marked as a duplicate of this bug. ***
Still happens with UCS-4.3-1, noticed during QA for Bug #47260
Successful build Package: univention-config-registry Version: 13.0.0-6A~4.3.0.201811121038 Branch: ucs_4.3-0 Scope: errata4.3-2 Successful build Package: ucs-test Version: 8.0.28-224A~4.3.0.201811121052 Branch: ucs_4.3-0 Scope: errata4.3-2 ------------------- univention-config-registry (13.0.0-6) e063d03f8e2d | Bug #35239: Merge branch 'jahlers/35239-ucr-handler-double-registr2' into 4.3-2 c72358089a0c | Bug #35239: fix double registration of ucr modules ucs-test (8.0.28-223) f6db8f23d1c9 | Bug #35239: fix test header e063d03f8e2d | Bug #35239: Merge branch 'jahlers/35239-ucr-handler-double-registr2' into 4.3-2 d2377693ce7b | Bug #35239: test double registration of ucr modules ucs-test (8.0.28-224) 9350e164dd91 | Bug #35239: ucs-test changelog univention-config-registry.yaml f69be95deb78 | Bug #35239: yaml ------------------ I added __hash__, __eq__ and __ne__ functions to the file, script and module confighandler classes. I didn't use __cmp__ methods as suggested by philipp as they will get removed with python 3. > May breaks if a script and/or module and/or file handler exists with the same name. This can, but shouldn't happen: - ConfigHandlerDiverting.to_file stores a path to a config file - ConfigHandlerModule.module stores a module name - ConfigHandlerScript.script stores a path to a script Those should normally never be the same, except if someone uses the config file module to replace variables in a script, and then run it. This should never be neccessary as you can easily access ucr variables in a script anyway. (Has this ever happened? Do we need a test case for this?)
Verified: * Code review * Test with updated package * Advisory c7cba1d254 | Advisory: small wording adjustment
<http://errata.software-univention.de/ucs/4.3/358.html>