Univention Bugzilla – Bug 38332
Cleanup scripts not run if running join from cli
Last modified: 2015-05-07 17:43:15 CEST
To join a system from the cli, univention-system-setup provides the script setup-join.sh. The is also called from the umc setup module. However, we have several scripts which are to be executed after system setup is completely finished, placed in /usr/lib/univention-system-setup/cleanup-{pre.d,post.d}. However, these are only called as an at job from the UMC module. No cleanup script will run when running setup-join.sh from the cli! This affects at least systems joining in ec2 and with cloud-init.
It would be nice to offer an option such as --run-cleanup for setup-join.sh.
Or just the other way around: implement a --do-not-run-cleanup, which is used by system setup - because it is currently the only consumer who does it itself
- I added a new parameter --do_not_run_cleanup, which is added by the UMC system setup module to the setup-join.sh call. If not given, run-parts calls are done at the end of the setup-join.sh script. While i was at it, i modified the run-parts calls to print the executed filename. This will help debugging the setup.log file. r60407 univention-system-setup 8.1.66-37.878.201505051342 r60408 2015-05-05-univention-system-setup.yaml
Looks very nice :) . I would suggest to replace the following lines -------------------- 8< -------------------- [...] if [ "$runcleanup" = true ]; then echo "=== Running cleanup-pre scripts $(date --rfc-3339=seconds)" run-parts -v /usr/lib/univention-system-setup/cleanup-pre.d echo "=== Running cleanup-post scripts $(date --rfc-3339=seconds)" run-parts -v /usr/lib/univention-system-setup/cleanup-post.d else [...] -------------------- 8< -------------------- ... with a call to /usr/lib/univention-system-setup/scripts/cleanup.py. This script is called via UMC, as well. It also takes care of copying the original scripts and executing their copies in order to prevent problems that might occur due to removing particular packages that ship cleanup scripts with them.
Another thing that I noticed... "run-parts -v" is not working as expected, it seems to write to stderr. Thus its output cannot be found in setup.log.
(In reply to Alexander Kläser from comment #5) > Another thing that I noticed... "run-parts -v" is not working as expected, > it seems to write to stderr. Thus its output cannot be found in setup.log. We identified that as an isolated problem during QA Switched to cleanup script in: r60424 univention-system-setup 8.1.66-39.880.201505051712 yaml updated
I just realized that cleanup.py redirects its stdout itself to /var/log/univention/setup.log... not sure whether this might collide when setup-join.sh is called with a redirection to setup.log? What do you think?
(In reply to Alexander Kläser from comment #7) > I just realized that cleanup.py redirects its stdout itself to > /var/log/univention/setup.log... not sure whether this might collide when > setup-join.sh is called with a redirection to setup.log? What do you think? No it does not collide. cleanup.py redirects its output, and the caller setup-join.sh simply receives nothing on stdout/stderr to redirect. To be sure i tested it with # /usr/lib/univention-system-setup/scripts/setup-join.sh >>/var/log/univention/setup.log 2>&1
I like the last commit :) ... univention-system-setup (8.1.66-41) [r60481]: * Bug #38332: cleanup.py does no longer redirect its output by default. util.py has been adapted accordingly Changes: OK YAML: OK, minor adjustment [r60486].
<http://errata.univention.de/ucs/4.0/190.html>