From c38814b1bcee8b154d8fb6ce17323f37976c6723 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 1 Apr 2024 18:24:06 -0700 Subject: [PATCH] nextcloud: Don't fail uninstall if DB or user don't not exist Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/nextcloud/privileged.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plinth/modules/nextcloud/privileged.py b/plinth/modules/nextcloud/privileged.py index 6560ae710..808a10709 100644 --- a/plinth/modules/nextcloud/privileged.py +++ b/plinth/modules/nextcloud/privileged.py @@ -295,8 +295,8 @@ def uninstall(): def _drop_database(): """Drop the mysql database that was created during install.""" with action_utils.service_ensure_running('mysql'): - query = f'''DROP DATABASE {DB_NAME}; - DROP User '{DB_USER}'@'localhost';''' + query = f'''DROP DATABASE IF EXISTS {DB_NAME}; + DROP USER IF EXISTS '{DB_USER}'@'localhost';''' subprocess.run(['mysql', '--user', 'root'], input=query.encode(), check=True)