Bug 53609 - App Settings in outside scope should be applied before containers are created and started
App Settings in outside scope should be applied before containers are created...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: App Center
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 4.4-8-errata
Assigned To: Dirk Wiesenthal
Erik Damrose
:
Depends on: 52506
Blocks: 53630
  Show dependency treegraph
 
Reported: 2021-07-23 15:37 CEST by Felix Botner
Modified: 2021-08-04 13:21 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain: 0.034
Enterprise Customer affected?:
School Customer affected?:
ISV affected?: Yes
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Workaround is available
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Botner univentionstaff 2021-07-23 15:37:03 CEST
+++ This bug was initially created as a clone of Bug #52506 +++

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.
Comment 1 Felix Botner univentionstaff 2021-07-23 15:52:01 CEST
f5325ecc1a8ed8af6f87a1553e0f94cbf817fd12 - univention-appcenter
set outside settings before preinst

e0da1bb7c6f26e3950c0f97a6048f2c8a3157b2c - univention-appcenter
pep8

c5e055814cba31c720570ed4cbd2cec0efd9f284 - ucs-test
added 20_appcenter/100_settings.py::test_outside_settings_in_preinst

387b24641789c5e7111e628c4c5bd7e26ac81e41 - yaml
Comment 2 Dirk Wiesenthal univentionstaff 2021-07-26 01:36:35 CEST
As discussed, while the patch works, it would be much cleaner to use the method "_configure". This method seems to be broken, though.

It overwrites explicitly set variables with the default ones. We should first fix the method and then use it to fix this bug right here.
Comment 3 Dirk Wiesenthal univentionstaff 2021-07-27 01:02:54 CEST
Done as advised.

Reverted f5325ecc1a8ed8af6f87a1553e0f94cbf817fd12

Instead, we fixed _configure and use it in

becdcddc

The tests still work. We do not yet test InitialValue and Upgrade/Remove yet. It should work, though.
Comment 4 Erik Damrose univentionstaff 2021-07-28 17:28:48 CEST
OK: univention-appcenter 8.0.11-148A~4.4.0.202107270037
OK: Fix _configure call
OK: Testcases in 20_appcenter/100_settings.py

Verified