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 <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-04-01 15:19:33 -07:00 committed by James Valleroy
parent 7c305fb295
commit d9132661c5
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -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}',