Univention Bugzilla – Bug 52506
App Settings in outside scope should be applied before containers are created and started
Last modified: 2021-08-04 13:21:12 CEST
The apps Jitsi and Bitwarden use App Settings with the outside scope and store the values in UCR variables. Furthermore, both apps use an environment file which is a UCR template referring to UCR variables that are created by the app settings. The problem is that app settings are evaluated after the Docker containers are created and started. The environment file is not yet updated and therefore the containers are initialized with the wrong values. The workaround for the problem is to add the following if block to the `configure_host` lifecycle script in the app: if [ "$1" = "install" ]; then univention-app reinitialize $appid fi This causes the the re-evaluation of the app settings and the UCR templates like compose and environment file for the app during the installation process. The containers are thrown away and recreated with the correct settings. The UCR variables are still configured from the initial installation run. Afterwards, the join script is run. The order of certain tasks during the installation process needs to be reviewed. As administrator and app provider I expect that app settings made before installation are correctly applied to the Docker containers regardless of the App Settings' scope. UCR template files like the app's Docker compose and the environment file also need to be taken into account.
Should also work for package based apps Setting: ... Show = Install, Settings Scope = outside Required = yes Start App Install, apply settings in App Settings Form, install the app currently this fails with: 12997 actions.configure 21-03-16 16:19:51 [ INFO]: Configuring app=1.0 112997 actions.configure 21-03-16 16:19:51 [CRITICAL]: Failed to configure: app: mysetting is required
* we only set settings, if they are given as set_vars (which is done for default values in UMC automatically) * set variables before preinst (so that one can check the settings in the preinst) * only set "outside" scope settings
7a3b13f4ad6be948b9626102e30db7488496e793 - univention-appcenter * added _set_outside_settings_in_ucr before _call_prescript during installation 489bbe0cae41713f00eda66f5f2dff9d8d1282aa - ucs-test * added 100_settings.py::test_outside_settings_in_preinst 28ecd067ba72c0d60578e5e87d43d27964289a62 - yaml The idea is that one ca use the preinst to test the settings and to abort the installation: preinst: eval "$(univention-config-registry shell)" for i in "$@"; do case "$i" in --binddn) shift 2 ;; --locale) shift 2 ;; --old-version) old_version="$2" shift 2 ;; --error-file) error_file="$2" shift 2 ;; --version) version="$2" shift 2 ;; --bindpwdfile) shift 2 ;; *) ;; esac done if [ "$myapp_mysetting1" != "setting ]; then echo "myapp/mystetting1 must be 'setting'" > $error_file exit 1 fi exit 0
Done as advised in Bug #53609 Comment 2. Reverted 7a3b13f4ad6be948b9626102e30db7488496e793 Instead, we fixed _configure and use it in 41023bd1 The tests still work. We do not yet test InitialValue and Upgrade/Remove yet. It should work, though. I also added a sentence to the documentation.
OK: univention-appcenter 9.0.2-57A~5.0.0.202107270016 OK: Fix _configure call OK~ Testcases in 20_appcenter/100_settings.py I added an 'apt-get update' call to the testcases, as the test failed on several roles, as the dummy package libcurl4-doc was not installable OK: yaml Verified
<https://errata.software-univention.de/#/?erratum=5.0x57>