Univention Bugzilla – Bug 55130
Regression in import_computer: specifying a network instead of specific IP address throws traceback
Last modified: 2022-11-02 14:13:34 CET
Starting with UCS@school 5.0v2 the script import_computer of the package "ucs-school-import" is no longer able to process network addresses as stated in the UCS@school manual: https://docs.software-univention.de/ucsschool-handbuch-5.0.html#school:schoolcreate:computers:import Before you were able to specify a network address, e.g. "10.20.0.0/255.255.248.0", and the script automatically determined the next free IP address in that subnet and assigned it to the computer. Now the following traceback is returned: root@master:~# /usr/share/ucs-school-import/scripts/import_computer \ /root/my_host_list.txt input file is : /root/my_host_list.txt Processing line 1: windows wsABC-123 AA:BB:CC:DD:EE:FF ABC 10.200.160.0/255.255.248.0 1234567890 Traceback (most recent call last): File "/usr/share/ucs-school-import/scripts/import_computer", line 179, in <module> import_computers(options.inputfile) File "/usr/share/ucs-school-import/scripts/import_computer", line 151, in import_computers computer.create(lo) File "/usr/lib/python3/dist-packages/ucsschool/lib/models/computer.py", line 295, in create return super(SchoolComputer, self).create(lo, validate) File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 547, in create success = self.create_without_hooks(lo, validate) File "/usr/lib/python3/dist-packages/ucsschool/lib/models/computer.py", line 298, in create_without_hooks self.create_network(lo) File "/usr/lib/python3/dist-packages/ucsschool/lib/models/computer.py", line 335, in create_network network = self.get_network() File "/usr/lib/python3/dist-packages/ucsschool/lib/models/computer.py", line 324, in get_network ipv4_network = self.get_ipv4_network() File "/usr/lib/python3/dist-packages/ucsschool/lib/models/computer.py", line 307, in get_ipv4_network if self.subnet_mask is not None and len(self.ip_address) > 0: TypeError: object of type 'NoneType' has no len()
An adapted ucs-test script that triggers the problem and a first attempt for a fix has been pushed to git: https://git.knut.univention.de/univention/ucsschool/-/merge_requests/145 Please note, that only the test script ./35_import-computers_via_cli.py has been tested yet! Other tests might fail like ./35_import-computers_via_python.py!
(In reply to Sönke Schwardt-Krummrich from comment #1) > An adapted ucs-test script that triggers the problem and a first attempt for > a fix has been pushed to git: > https://git.knut.univention.de/univention/ucsschool/-/merge_requests/145 > > Please note, that only the test script ./35_import-computers_via_cli.py has > been tested yet! Other tests might fail like > ./35_import-computers_via_python.py! The MR makes it possible to import computers again, but import_computer always uses the netmask 255.255.255.0 even if a different netmask like 255.255.248.0 is specified!
A customer has created client networks that differ from the standard /24 mask. He is now not able to import new Clients, because even if he gives each client its own IP and specify the subnet, the importer has always created a new network with a /24 mask.
https://git.knut.univention.de/univention/ucsschool/-/issues/911
Next customer can into this, after upgrade to UCS5. Specifying the subnet mask of a class B network does not work anymore, so customer with Class B net, cannot import computers anymore. Import is done but class C networks are created in the network of the OU and in the Dhcp. In DNS, the reverse zones are shared between class C networks. Examples: Bsp. Importdatei: mit Angabe Subnetz ausgeschrieben windows mstest-vbc-006 90:2b:34:13:6a:4f ms_test 10.226.15.21/255.255.0.0 1234567 Multimedia PC wir2 serien3456 windows mstest-vbc-004 68:f7:28:1e:6c:7c ms_test 10.226.15.19/255.255.0.0 3456789 testpctest seriennr1234 Ausgabe Vi mit set list windows^Imstest-vbc-006^I90:2b:34:13:6a:4f^Ims_test^I10.226.15.21/255.255.0.0^I1234567^I^IMultimedia PC wir2^Iserien3456$ windows^Imstest-vbc-004^I68:f7:28:1e:6c:7c^Ims_test^I10.226.15.19/255.255.0.0^I3456789^I^Itestpctest^Iseriennr1234$ mit verkürtzer Schreibweise windows mstest-vbc-006 90:2b:34:13:6a:4f ms_test 10.226.15.21/16 1234567 Multimedia PC wir2 serien3456 windows mstest-vbc-004 68:f7:28:1e:6c:7c ms_test 10.226.15.19/16 3456789 testpctest seriennr1234 Ausgabe Vi mit set list windows^Imstest-vbc-006^I90:2b:34:13:6a:4f^Ims_test^I10.226.15.21/16^I1234567^I^IMultimedia PC wir2^Iserien3456$ windows^Imstest-vbc-004^I68:f7:28:1e:6c:7c^Ims_test^I10.226.15.19/16^I3456789^I^Itestpctest^Iseriennr1234$
The subnet mask had not been passed to the ucs-school-lib computer object. Thanks for the pre-work to Sönke! The fix will be released next week (because tomorrow is Friday) and Monday is a public holiday and we want jenkins to pass. [5.0] 49cd391a7 Bug #55130: advisory fix [5.0] 94a37223a Bug #55130: changelog + advisories [5.0] 0e2e2b6ae Bug #55130: pass IP address/subnet to UCS@school lib in any case Package: ucs-school-import Version: 18.0.23A~5.0.0.202210271327 Branch: ucs_5.0-0 Scope: ucs-school-5.0 Package: ucs-test-ucsschool Version: 7.3.76A~5.0.0.202210271330 Branch: ucs_5.0-0 Scope: ucs-school-5.0
Errata updates for UCS@school 5.0 v3 have been released. https://docs.software-univention.de/ucsschool-changelog/5.0v3/de/changelog.html If this error occurs again, please clone this bug.