Univention Bugzilla – Bug 42690
App Center does not make sure the database exists when reinstalling an app
Last modified: 2018-12-05 14:39:05 CET
When installing an app that has a database in its ini file, the appcenter only checks if the database user is already created. It would be nice to check for the table as well. While this should only affect developers, I think it would help ISV to debug their app.
For the App Center the create_database() call succeeds if a password and a DB user for the app exist. That is not enough. If we allow ISVs to add arbitrary scripts which can backup and delete the DB, we have to ensure everything is working when an app is installed. The App Center does not check * if the correct database exists (would get bonus points for checking GRANTS to db user) * if the db user can login with the password from the secrets file Workaround for ISV: when dropping the DB, also delete $appid.secret
Yes, we do give App Providers the ability to delete the DB in a script. But they have to do this explicitly. We do not support deleting the DB for them. Therefore, I would not call this a workaround, but the way to go. (Granted, this is tedious work for App Providers) Currently, the checks are limited for performance reasons. The database is part of the registration and therefore executed quite often. Maybe we could remove the database integration from the registration and then do more expensive checks. (Even the db_user_exists() check would be skipped if there would not exist some corner cases where this is actually a problem during installation - no custom scripts involved)
After a failed upgrade of the owncloud app it turned out to be a missing database (or rather an empty one) to be the cause for failing re-installation of the app. We had to install the app with --do-not-revert and afterwards use docker inspect to find the cause in error messages from owncloud.
The checks for the existence now check if the database exists by querying the internal tables of the database and if the database user exists.
OK, works
<http://errata.software-univention.de/ucs/4.3/345.html>