Univention Bugzilla – Bug 54558
make /etc/hosts.d/20-static UCR template idempotent
Last modified: 2022-05-25 18:33:29 CEST
03_ucr/37check-ucr-templates-py3-migration-status.test_configfile_python_compatibility[/etc/univention/templates/files/etc/hosts.d/20-static] revealed that the UCR template is not idempotent. Patch: diff --git base/univention-base-files/conffiles/etc/hosts.d/20-static base/univention-base-files/conffiles/etc/hosts.d/20-static index 57979353e2..19c9c05878 100644 --- base/univention-base-files/conffiles/etc/hosts.d/20-static +++ base/univention-base-files/conffiles/etc/hosts.d/20-static @@ -1,7 +1,7 @@ @!@ # Add static addresses "hosts/static/$ip=$names" PREFIX = 'hosts/static/' -for key, value in configRegistry.items(): +for key, value in sorted(configRegistry.items()): if key.startswith(PREFIX) and key != PREFIX: print("%s\t%s" % (key.split('/')[-1], value)) @!@
37check-ucr-templates-py3-migration-status.py::test_configfile_python_compatibility[/etc/univention/templates/files/etc/hosts.d/20-static] Py2:|✅|100% Py3:|✅|100% PASSED
Suggested patch applied. Now the content of /etc/hosts is idempotent. With this fix the entries are ordered before they are written to the file. Fixed on version 9.0.3-8. See commit 6f96d73c
<https://errata.software-univention.de/#/?erratum=5.0x315>