Univention Bugzilla – Bug 54475
import_computer fails with traceback
Last modified: 2022-06-08 09:13:56 CEST
while checking a scenario that used to work in 4.4-8 with 5.0-1 I noticed the following problem: root@dn1:~# /usr/share/ucs-school-import/scripts/import_computer schulea_computer.tsv infile is : schulea_computer.tsv Processing line 1: windows win-a-01 00:50:56:b6:d0:63 SchuleA 10.0.10.151 WARNING: no netmask specified for ip address 10.0.10.151/24 using 255.255.255.0 generate computer win-a-01 (school SchuleA) Traceback (most recent call last): File "/usr/share/ucs-school-import/scripts/import_computer", line 3100, in <module> import_computer() File "/usr/share/ucs-school-import/scripts/import_computer", line 2088, in import_computer success, dn = create_network(schoolNr, ip_iface.network) File "/usr/share/ucs-school-import/scripts/import_computer", line 1400, in create_network if check_network(schoolNr, network): File "/usr/share/ucs-school-import/scripts/import_computer", line 1516, in check_network escape_dn_chars(network.network_address), File "/usr/lib/python3/dist-packages/ldap/dn.py", line 23, in escape_dn_chars s = s.replace('\\','\\\\') AttributeError: 'IPv4Address' object has no attribute 'replace' also noticed by a customer in https://help.univention.com/t/import-rechnerobjekt-per-script/19219
The function "def escape_dn_chars(s):" in "/usr/lib/python3/dist-packages/ldap/dn.py" expects the variable "s" to be a string. The script "/usr/share/ucs-school-import/scripts/import_computer" uses this function to escape the characters in an 'IPv4Address' object not a string! Workaround: Edit file "/usr/share/ucs-school-import/scripts/import_computer" change line 1516 [-] escape_dn_chars(network.network_address), [+] escape_dn_chars(str(network.network_address)),
school customer affected