Bug 51624 - Delay execution of join scripts to postup.sh
Delay execution of join scripts to postup.sh
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Join (univention-join)
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 4.4-6-errata
Assigned To: Sönke Schwardt-Krummrich
Philipp Hahn
:
Depends on: 52197
Blocks: 52909
  Show dependency treegraph
 
Reported: 2020-07-06 14:16 CEST by Sönke Schwardt-Krummrich
Modified: 2021-03-15 21:15 CET (History)
2 users (show)

See Also:
What kind of report is it?: Development Internal
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 Sönke Schwardt-Krummrich univentionstaff 2020-07-06 14:16:28 CEST
To avoid problems with listener modules during the update from UCS 4.4 to 5.0 and especially to avoid lost transactions, LDAP changes should be delayed until postup.sh/end of the update.

For this purpose, at least the join script helper call_joinscript must be adapted so that it does NOT execute any more join scripts on the Primary Directory Node/Domain Controller Master during the release update.
Alternatively/additionally it can also be checked whether the joinscripthelper library terminates/terminates the join script specifically during a release update.

Important: postinst scripts must not rely on the fact that join scripts called in them will run successfully!
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2020-10-12 21:22:36 CEST
The joinscripthelper.lib has been modified. Upon joinscript_init, the file /var/lib/univention-updater/univention-updater.status is checked and if status=RUNNING and phase=PREUP/UPDATE and next_version>=5.0-0, the join script is aborted with a corresponding error message:
"""A system update is currently being performed. The execution of the join script $JS_SCRIPT_FULLNAME is therefore postponed."""

If next_version is below "5.0-0" or the file univention-updater.status is missing, the old, known behaviour of UCS 4 is used.

A new test script 20postponed_joinscripts has been added to ucs-test, that checks the joinscript execution during the update:
- 4.4-7 → 5.0.0
- 5.1-14 → 5.1-15
- 4.4-6 → 4.4-7
If version/version > 5.0:
- ${version_version}-${version_patchlevel} → ${version_version}-${version_patchlevel+1}

Changes have been made in branch sschwardt/446/US1205-no-joinscript-during-update
Comment 2 Philipp Hahn univentionstaff 2020-10-16 16:52:37 CEST
PRE: tail -n1 /etc/apt/sources.list
> deb [trusted=yes] http://omar.knut.univention.de/build2//git/sschwardt-446-us1205-no-joinscript-during-update git main
OK: 4593d7e47cb6cbb9e1c9d5adfc3d567a85a0c00a
OK: 24a78ed738312de77007329d0230fed7afa3640b
OK: e43de4af594ccfc8fb1825b1e4cb13f212ca3fdf
OK: apt-get install -t git univention-updater
PRE: ucr set version/patchlevel=5
OK: univention-upgrade --ignoressh --ignoreterm --noninteractive --updateto 5.0-0 </dev/null
OK: 938000e26a7f30f5164bee10d03cbb06006a05f0

OK: 6f3f5f83ba0d3cd43c7efd1a3446668aed74c258
OK: 6fb02f5782d8c1e878d0a4954d37aed1fb62e1aa
OK: c17452a62a8eb21b78090a6ef5ffad0412d33cf3
OK: apt-get install -t git ucs-test-updater
OK: /usr/share/ucs-test/09_updater/29updater-status -vf

OK: 6eda24ac6cd733026d7e95b0f929a766e4f4d245
OK: b27a44bf12e609acbb13973a13e03724fca59f76
OK: 9392959e6aca3e8abc4f6188a45e6b1e43580b13
OK: apt-get install -t git univention-join
OK: . /usr/share/univention-join/joinscripthelper.lib
OK: joinscript_is_update_running ; echo $?
OK: printf 'next_version=4.0-0\n' >"$FN_STATUS" && joinscript_is_update_running ; echo $? # 1
OK: printf 'next_version=5.0-0\n' >"$FN_STATUS" && joinscript_is_update_running ; echo $? # 1
OK: printf 'next_version=5.0-0\nstatus=RUNNING\n' >"$FN_STATUS" && joinscript_is_update_running ; echo $? # 1
OK: printf 'next_version=5.0-0\nstatus=RUNNING\nphase=PREUP\n' >"$FN_STATUS" && joinscript_is_update_running ; echo $? # 0
OK: printf 'next_version=5.0-0\nstatus=RUNNING\nphase=UPDATE\n' >"$FN_STATUS" && joinscript_is_update_running ; echo $? # 0
OK: printf 'next_version=5.0-0\nstatus=RUNNING\nphase=POSTUP\n' >"$FN_STATUS" && joinscript_is_update_running ; echo $? # 1

FAIL: f7806dbb9ad0848f66ac2290b6716535279afaed (several minor comments and 1 bug in 4th test case)
OK: 39014322084b33743469eeec89a457f04a9b411a
OK: apt install ucs-test-{libs,join}=9.0.5-15
OK: /usr/share/ucs-test/11_join/20postponed_joinscripts -vf
OK: ucr set version/version=5.0 version/patchlevel=0 version/erratalevel=0 ; ..
Comment 3 Philipp Hahn univentionstaff 2020-10-16 17:27:26 CEST
OK: e3e10d86db1f277f7e58ce2116c6f6b866a21763
OK: ./20postponed_joinscripts -vf

Lets see how the update works...
Comment 4 Philipp Hahn univentionstaff 2020-10-16 17:34:19 CEST
Needs to be merged to UCS-4.4-6 and UCS.5-0-0
Comment 5 Sönke Schwardt-Krummrich univentionstaff 2020-10-16 17:59:52 CEST
(In reply to Philipp Hahn from comment #4)
> Needs to be merged to UCS-4.4-6 and UCS.5-0-0

Merged to 4.4-6 and built. 

Package: univention-join
Version: 11.0.1-31A~4.4.0.202010161743
Branch: ucs_4.4-0
Scope: errata4.4-6
Comment 6 Philipp Hahn univentionstaff 2020-10-16 18:21:04 CEST
OK: errata-announce -V --only univention-join.yaml
Comment 8 Sönke Schwardt-Krummrich univentionstaff 2021-03-15 12:57:51 CET
To improve usability, the "postpone" message is in UCS 5.0 only shown, if the joinscript version has never been run. The UCS 4.4 version is left untouched for now.

[5.0-0] 65e6b712d6 Bug #51624: show message only if joinscript shall be executed
[5.0-0] 030c4eca2f fixup! Bug #51624: show message only if joinscript shall be executed

Successful build
Package: univention-join
Version: 12.0.3-2A~5.0.0.202103151252
Branch: ucs_5.0-0
Comment 9 Florian Best univentionstaff 2021-03-15 21:15:58 CET
OK