Univention Bugzilla – Bug 52259
Migrate univention-dhcp to Python 3
Last modified: 2021-05-25 15:59:05 CEST
univention-dhcp should be migrated to be Python 3 compatible.
import-dhcpd.conf is not part of the shipped package - I converted it nevertheless. Package: univention-dhcp Version: 14.0.2-5A~5.0.0.202012011402 Branch: ucs_5.0-0 [5.0-0] a7e5b0b069 Bug #52259 DHCP: Convert to Python 3 doc/changelog/changelog-5.0-0.xml | 2 +- services/univention-dhcp/debian/changelog | 1 + services/univention-dhcp/dhcp.py | 2 + services/univention-dhcp/import-dhcpd.conf | 190 +++++++++++++++++++++++++++++++------------------ 4 files changed, 123 insertions(+), 72 deletions(-)
Do you want to convert the joinscript as well? And change the dependency to python3-univention-lib.
Created attachment 10622 [details] dhcpd.conf Traceback (most recent call last): File "./import-dhcpd.conf", line 392, in <module> sections[depth][4].append((otype, result)) IndexError: list index out of range
(In reply to Florian Best from comment #3) > File "./import-dhcpd.conf", line 392, in <module> > IndexError: list index out of range See comment #1: > import-dhcpd.conf is not part of the shipped package - I converted it nevertheless. that script is an evil hack and will fail on more examples than succeed. It is not worth fixing until explicitly requested. In your case is simply does not support "shared-network" in line 92ff. (In reply to Florian Best from comment #2) > Do you want to convert the joinscript as well? And change the dependency to > python3-univention-lib. [5.0-0] 4359208b7a Bug #52259 dhcp: Convert to Python3 services/univention-dhcp/25univention-dhcp.inst | 74 +------------------- services/univention-dhcp/debian/changelog | 6 ++ services/univention-dhcp/debian/univention-dhcp.install | 6 +- services/univention-dhcp/etc/runit/univention-dhcp/run | 30 --------- services/univention-dhcp/import-dhcpd.conf | 42 ++++-------- services/univention-dhcp/usr/lib/univention-dhcp/create-subnets | 101 ++++++++++++++++++++++++++++ 6 files changed, 125 insertions(+), 134 deletions(-) [5.0-0] d708a7ce49 fixup! Bug #52259 dhcp: Convert to Python3 services/univention-dhcp/usr/lib/univention-dhcp/create-subnets | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) Package: univention-dhcp Version: 14.0.3-2A~5.0.0.202102171832 Branch: ucs_5.0-0
(In reply to Florian Best from comment #2) > And change the dependency to python3-univention-lib. forgot to change that: [5.0-0] 4832179d11 Bug #52259 dhcp: Convert to Python 3 services/univention-dhcp/debian/changelog | 6 ++++++ services/univention-dhcp/debian/control | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) Bug fixed by @fbest - thanks: [5.0-0] 070a9a76fb fixup! Bug #52259 dhcp: Convert to Python3 services/univention-dhcp/usr/lib/univention-dhcp/create-subnets | 1 - 1 file changed, 1 deletion(-) Package: univention-dhcp Version: 14.0.3-3A~5.0.0.202102180747 Branch: ucs_5.0-0 OK: /usr/lib/univention-dhcp/create-subnets --help OK: S="$(udm dhcp/service list | sed -ne 's/^DN: //p;T;q')" OK: /usr/lib/univention-dhcp/create-subnets --service "$S" OK: /usr/lib/univention-dhcp/create-subnets --service "$S" --binddn "$(ucr get ldap/hostdn)" --bindpwdfile /etc/machine.secret OK: /usr/lib/univention-dhcp/create-subnets --service "$S" --binddn "$(ucr get ldap/hostdn)" --bindpwd "$(</etc/machine.secret)" OK: P="$(udm policies/dhcp_dns list | sed -ne 's/^DN: //p;T;q')" OK: /usr/lib/univention-dhcp/create-subnets --service "$S" --policy-reference "$P"
OK
FYI: During my update from 4.4-7+e898 to 5.0-0~2021-02-20 univention-dhcp failed the upgrade: From /var/log/univention/updater.log univention-dhcp (14.0.3-3A~5.0.0.202102180747) wird eingerichtet ... ... 2021-02-20 11:50:06.699634985+01:00 (in joinscript_init) A system update is currently being performed. The execution of the join script /usr/lib/univention-install/25univention-dhcp.inst is therefore postponed. isc-dhcp-server.service is not a native service, redirecting to systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install is-enabled isc-dhcp-server univention-firewall.service is not a native service, redirecting to systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install is-enabled univention-firewall Job for isc-dhcp-server.service failed because the control process exited with error code. See "systemctl status isc-dhcp-server.service" and "journalctl -xe" for details. dpkg: Fehler beim Bearbeiten des Paketes univention-dhcp (--configure): »installiertes univention-dhcp-Skript des Paketes post-installation«-Unterprozess gab den Fehlerwert 1 zurück /var/log/daemon.log only has: Feb 20 11:53:21 m34 dhcpd[5405]: Configuration file errors encountered -- exiting
UCS 5.0 has been released: https://docs.software-univention.de/release-notes-5.0-0-en.html https://docs.software-univention.de/release-notes-5.0-0-de.html If this error occurs again, please use "Clone This Bug".