nextcloud: Fix existing installs to upgrade properly

Fixes: #2433.

Tests:

- Without the patches, as described in the bug, create an installation that is
facing the problem. Ensure that 'podman exec --user www-data
nextcloud-freedombox /var/www/html/occ config:system:get overwrite.cli.url'
shows an empty value.

- Apply patches, nextcloud app is updated and configuration value is set to
'http://localhost/nextlcoud' by running 'podman exec --user www-data
nextcloud-freedombox /var/www/html/occ config:system:get overwrite.cli.url'.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-09-19 21:39:56 -07:00 committed by James Valleroy
parent afb69c28d1
commit 2a30d64f08
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -46,7 +46,7 @@ class NextcloudApp(app_module.App):
app_id = 'nextcloud'
_version = 1
_version = 2
configure_when_disabled = False
@ -128,6 +128,13 @@ class NextcloudApp(app_module.App):
def setup(self, old_version):
"""Install and configure the app."""
if old_version == 1:
with _ensure_nextcloud_running():
# Reset the value so that 'overwrite.cli.url' is set to default
# value instead of it being missing.
if not privileged.get_override_domain():
privileged.set_override_domain('')
super().setup(old_version)
# Drop-in configs need to be enabled for setup to succeed
self.get_component('dropin-configs-nextcloud').enable()