Bug 53756 - Abort upgrade from UCS 4.4 to 5.0 if hooks for UCS@school-Import are not Python 3 compatible
Abort upgrade from UCS 4.4 to 5.0 if hooks for UCS@school-Import are not Pyth...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Update - Release updates
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-0-errata
Assigned To: Florian Best
Felix Botner
: interim-6
Depends on:
Blocks: 52578
  Show dependency treegraph
 
Reported: 2021-09-07 11:23 CEST by Daniel Tröder
Modified: 2022-06-27 21:09 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Release Management
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?:
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 2021-09-07 11:23:36 CEST
An upgrade from UCS 4.4 to UCS 5.0 should be aborted if the user has Python-Hooks for the UCS@school-Import installed, that are not Python 3 compatible.

The pre-up.sh script should scan installed UCS@school Import-Hooks für Python 3 compatibility.
Comment 1 Florian Best univentionstaff 2021-09-08 14:19:06 CEST
The hooks are in /usr/share/ucs-school-import/hooks/*/*.py and /usr/share/ucs-school-import/pyhooks/*.py ? Or are there more locations?
Comment 2 Daniel Tröder univentionstaff 2021-09-09 07:42:17 CEST
Sorry, I should have mentioned that earlier.
Below /usr/share/ucs-school-import/hooks were only run-part hooks, mostly shell. Nowadays there should be nothing anymore.

Python hooks are directly below two directories:
* /usr/share/ucs-school-import/checks/
* /usr/share/ucs-school-import/pyhooks/
Comment 3 Florian Best univentionstaff 2021-09-15 17:00:48 CEST
Added a preup.sh check which checks the python 3 syntax compatibility of:
/usr/share/ucs-school-import/checks/**/*.py
/usr/share/ucs-school-import/pyhooks/**/*.py

4eae66c08896 | Bug #53756: check hooks for Python 3 compatibility in preup.sh
Comment 5 Felix Botner univentionstaff 2021-09-17 09:29:07 CEST
Works:

Do you want to continue [Y|n]? n

Checking for app updates:                               skipped
Checking for release updates:                           found: UCS 5.0-0
Do you want to update to 5.0-0 [Y|n]? Y

Starting update to UCS version 5.0-0
Checking python_ucsschool_import_hook_compatibility ... FAIL

The system can not be updated to UCS  due to the following reasons:

python_ucsschool_import_hook_compatibility:
The following UCS@school Import Hooks are not compatible with Python 3:
	 /usr/share/ucs-school-import/pyhooks/myhook.py

Error: Please check "/var/log/univention/updater.log" for details.
ERROR: update failed. Please check /var/log/univention/updater.log

Should we add this test to https://updates.software-univention.de/download/univention-update-checks/pre-update-checks-5.0-0 so that customers can check the update "readiness" of their systems.
Comment 6 Florian Best univentionstaff 2021-09-17 11:59:05 CEST
* ucsschool preup.sh reverted + published
* UCS check.sh + preup.sh updated + published
Comment 7 Felix Botner univentionstaff 2021-09-17 12:19:21 CEST
OK - removed from school preup

OK - pre-update-checks-5.0-0

-> curl -OOf https://updates.software-univention.de/download/univention-update-checks/pre-update-checks-5.0-0{.gpg,}
 
-> apt-key verify pre-update-checks-5.0-0{.gpg,} 
gpgv: Signature made Fr 17 Sep 2021 11:28:25 CEST
gpgv:                using RSA key D293E501A055F562
gpgv: Good signature from "Univention Corporate Server 5.x <packages@univention.de>"

-> bash pre-update-checks-5.0-0 update_check_python_ucsschool_import_hook_compatibility

Starting pre-update-checks-5.0-0 (Fr 17. Sep 12:06:33 CEST 2021):
dpkg-query: Kein Pfad gefunden, der auf Muster /usr/share/ucs-school-import/pyhooks/myhook.py passt
The following UCS@school Import Hooks are not compatible with Python 3:
	 /usr/share/ucs-school-import/pyhooks/myhook.py

OK - ucs5.0-0 preup

-> univention-upgrade --ignoressh --ignoreterm --disable-app-updates
...
Starting update to UCS version 5.0-0
...
Checking python_ucsschool_import_hook_compatibility ... FAIL
...
The system can not be updated to UCS 5.0 due to the following reasons:

python_ucsschool_import_hook_compatibility:
The following UCS@school Import Hooks are not compatible with Python 3:
	 /usr/share/ucs-school-import/pyhooks/myhook.py

Error: Please check "/var/log/univention/updater.log" for details.
ERROR: update failed. Please check /var/log/univention/updater.log