Bug 47448 - Create interface for custom configuration checks
Create interface for custom configuration checks
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.3
Other Linux
: P5 normal (vote)
: UCS@school 4.3 v5
Assigned To: Daniel Tröder
Sönke Schwardt-Krummrich
:
Depends on: 45715
Blocks: 47447
  Show dependency treegraph
 
Reported: 2018-08-02 15:23 CEST by Daniel Tröder
Modified: 2018-09-11 11:34 CEST (History)
0 users

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 2: Improvement: Would be a product improvement
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.046
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2018-08-02 15:23:41 CEST
When creating derivative works of the UCS@school import, specific configuration requirements may have to be met.

If checking for a correct configuration can only be done in hooks or derived classes, then the exceptions can only be raised after starting an import.

Create an interface that allows adding custom configuration checks.
Comment 1 Daniel Tröder univentionstaff 2018-08-02 17:06:26 CEST
Depends on Bug #45715, because it requires the PyHooksLoader class with filtering support.

[4.3] 999c96a57 Bug #47448: create interface for custom configuration checks
[4.3] 141b424b8 Bug #47448: use new interface for default configuration checks
[4.3] 84f5b7361 Bug #47448: require PyHooksLoader with filtering support
[4.3] 2d0c32879 Bug #47448: add ucs-test for custom configuration check interface
[4.3] 218f92760 Bug #47447 Bug #47448: changelog
[4.3] e0d7a329b Bug #47447 Bug #47448: Merge branch 'dtroeder/SiSoMi.scenario' into 4.3
[4.3] d02743564 Bug #47447 Bug #47448: advisory

ucs-school-import (16.0.2-30)
ucs-test-ucsschool (5.0.2-75)

Not yet resolved, because the import documentation must still be updated.

The internal documentation is already online: https://billy.knut.univention.de/~dtroeder/http-api-doc/python/ucsschool.importer.utils.html#module-ucsschool.importer.utils.configuration_checks
Comment 2 Daniel Tröder univentionstaff 2018-08-02 17:10:09 CEST
A ucs-test was added: 238_import_user_custom_config_check.
Comment 3 Daniel Tröder univentionstaff 2018-08-03 09:25:35 CEST
Added a section to the official import documentation. 
238_import_user_custom_config_check ran successfully in Jenkins.

http://jenkins.knut.univention.de:8080/job/UCSschool-4.3/job/Handbook/6/artifact/webroot/ucsschool-import-handbuch-4.3.html#extending
Comment 4 Sönke Schwardt-Krummrich univentionstaff 2018-08-31 14:43:53 CEST
Some small fixes have been comitted to the manual:
39a691816 Bug #47448: small fixes in ucsschool-import-handbuch-4.3.xml

As expected, the import throws an error, if the check fails:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/cmdline.py", line 110, in main
    self.setup_config()
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/cmdline.py", line 74, in setup_config
    self.config = setup_configuration(configs, **self.args.settings)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/configuration.py", line 47, in setup_configuration
    run_configuration_checks(config)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/utils/configuration_checks.py", line 110, in run_configuration_checks
    method()
  File "/usr/share/ucs-school-import/checks/test238_custom_conf_check.py", line 9, in test_forbidden_birthday
    raise InitialisationError('Thou shalt not import birthdays!')
InitialisationError: Thou shalt not import birthdays!
2018-08-31 14:34:35 INFO: run_import:475: Import process exited with exit code 1
2018-08-31 14:34:35 ERROR: run_import:477: As requested raising an exception due to non-zero exit code


OK: code change
OK: functional change
OK: tests (ucs-test is ok)
OK: changelog entry
OK: advisory
OK: package built and installable
Comment 5 Sönke Schwardt-Krummrich univentionstaff 2018-09-11 11:34:18 CEST
UCS@school 4.3 v5 has been released.

https://docs.software-univention.de/changelog-ucsschool-4.3v5-de.html

If this error occurs again, please clone this bug.