From d9132661c56ee7a55a65cb0fb1b76b1deb521054 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 1 Apr 2024 15:19:33 -0700 Subject: [PATCH] nextcloud: Improve check used to test if installation wizard is done Use the status command to retrieve the accurate status of installation instead of checking for existence of admin user account. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/nextcloud/privileged.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plinth/modules/nextcloud/privileged.py b/plinth/modules/nextcloud/privileged.py index 0b3b6b18c..c5769ad4e 100644 --- a/plinth/modules/nextcloud/privileged.py +++ b/plinth/modules/nextcloud/privileged.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """Configure Nextcloud.""" +import json import pathlib import random import re @@ -187,9 +188,15 @@ FLUSH PRIVILEGES; check=True) +def _nextcloud_get_status(): + """Return Nextcloud status such installed, in maintenance, etc.""" + output = _run_occ('status', '--output=json', capture_output=True) + return json.loads(output.stdout) + + def _nextcloud_setup_wizard(db_password, admin_password): - admin_data_dir = _volume_path / '_data/data' / GUI_ADMIN - if not admin_data_dir.exists(): + """Run the Nextcloud installation wizard and enable cron jobs.""" + if not _nextcloud_get_status()['installed']: _run_occ('maintenance:install', '--database=mysql', '--database-host=localhost:/run/mysqld/mysqld.sock', f'--database-name={DB_NAME}', f'--database-user={DB_USER}',