Bug 48188 - run pre-read-hooks in ucs-school-import
run pre-read-hooks in ucs-school-import
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.3
Other Linux
: P5 normal (vote)
: UCS@school 4.3 v8
Assigned To: Daniel Tröder
Ole Schwiegert
:
Depends on:
Blocks: 48189 48958 49049 49268
  Show dependency treegraph
 
Reported: 2018-11-21 15:10 CET by Daniel Tröder
Modified: 2019-04-09 14:23 CEST (History)
4 users (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
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-11-21 15:10:45 CET
Create a hook that allows to modify the input data before it is read. It should be run directly after reading the configuration.

It is passed an instance of the configuration object and a /path/filename, and is expected to return a /path/filename.

The returned /path/filename is used as input for the import.
The configuration object must be changed to allow updating the filename.
The hooks must work from the command line and from HTTP-API.
Comment 1 Daniel Tröder univentionstaff 2018-11-21 15:17:11 CET
In case of a HTTP-API triggered import, *both* the original input file and the new input file must be copied to /var/lib/ucs-school-import/jobs/$YEAR/$JOBID.
Comment 2 Daniel Tröder univentionstaff 2019-03-07 16:23:51 CET
WIP (should be complete, but is untested) in dtroeder/48188_pre-read-hook
Comment 3 Daniel Tröder univentionstaff 2019-03-11 18:34:45 CET
OK, works. I added a test (commit labeled falsely for Bug #48189).

[dtroeder/48188_pre-read-hook] 03b748a97 Bug #48188: add type hints
[dtroeder/48188_pre-read-hook] 50d8e8a2c Bug #48188: make hook loader reusable
[dtroeder/48188_pre-read-hook] 55a9fbb95 Bug #48188: add pre-read hook support
[dtroeder/48188_pre-read-hook] f180a2219 Bug #48188: fix import, improve error message
[dtroeder/48188_pre-read-hook] ea96ecaca Bug #48189: add test for pre-read hook

Please reopen, when starting QA (missing merge, changelog and package build).
Comment 4 Daniel Tröder univentionstaff 2019-03-12 16:01:33 CET
Merged to 4.4 as part of work on Bug #48958.
Comment 5 Ole Schwiegert univentionstaff 2019-03-13 14:05:08 CET
Package installs: OK
Test passes: OK
Hook function working: OK

Please merge and create changelog and advisory
Comment 6 Daniel Tröder univentionstaff 2019-03-13 17:18:16 CET
Merge to 4.3:

[4.3] 6b41925e2 Bug #48188: add type hints
[4.3] 15feb7c00 Bug #48188: make hook loader reusable
[4.3] 1139c17be Bug #48188: add pre-read hook support
[4.3] a18e47214 Bug #48188: fix import, improve error message
[4.3] 3ebd89dbb Bug #48188: fix test tags
[4.3] 1d42a6f85 Bug #48188, Bug #48189: advisory

ucs-school-import (16.0.3-6)

Merge to 4.4:

[4.4] fb2aef538 Bug #48188: add type hints
[4.4] 209734859 Bug #48188: make hook loader reusable
[4.4] 3697db3dd Bug #48188: add pre-read hook support
[4.4] 2403d336c Bug #48188: fix import, improve error message
[4.4] ccdebebe5 Bug #48188: fix test tags
Comment 7 Ole Schwiegert univentionstaff 2019-03-18 09:18:03 CET
Documentation: missing (At least not found in https://billy.knut.univention.de/~dtroeder/http-api-doc/hooks.html except for the API-Doc) [REOP]

4.4:
Changelog: Bug not mentioned
Advisories: missing
ucs-test: OK
Input files present in /var/lib/ucs-school-import/jobs/$YEAR/$JOBID: OK
Import via HTTP-API: OK

4.3:
Changelog&Advisory: OK
ucs-test: OK
Input files present in /var/lib/ucs-school-import/jobs/$YEAR/$JOBID: OK
Import via HTTP-API: OK
Comment 8 Daniel Tröder univentionstaff 2019-03-18 10:49:40 CET
[4.4 b621d987f] Bug #48188: advisory
[4.4 2acd04055] Bug #48188: add PreReadPyHook to hook sequence diagram

Changelog will be build from advisory, when it is released.
Documentation isn't public yet, so the package was not rebuilt.
Comment 9 Ole Schwiegert univentionstaff 2019-03-18 11:02:35 CET
OK.
Comment 10 Sönke Schwardt-Krummrich univentionstaff 2019-04-01 00:44:22 CEST
UCS@school 4.3 v8 has been released.

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

If this error occurs again, please clone this bug.