From f52bfab99319fa21b15c9ba3b47449c9a0535eb1 Mon Sep 17 00:00:00 2001 From: nbenedek Date: Tue, 11 Apr 2023 20:48:51 +0200 Subject: [PATCH] samba: Completely uninstall app Drop all Samba shares when app is uninstalled Test: 1. Install app, enable Open Share and Group Share 2. Reinstall app and confirm all shares get dropped Signed-off-by: nbenedek [sunil: Update docstrings] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- plinth/modules/samba/__init__.py | 5 +++++ plinth/modules/samba/privileged.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/plinth/modules/samba/__init__.py b/plinth/modules/samba/__init__.py index 2a2cd21f2..ef2bee768 100644 --- a/plinth/modules/samba/__init__.py +++ b/plinth/modules/samba/__init__.py @@ -102,6 +102,11 @@ class SambaApp(app_module.App): if not old_version: self.enable() + def uninstall(self): + """De-configure and uninstall the app.""" + super().uninstall() + privileged.uninstall() + class SambaBackupRestore(BackupRestore): """Component to backup/restore Samba.""" diff --git a/plinth/modules/samba/privileged.py b/plinth/modules/samba/privileged.py index 3f6cb267a..adb2d41d0 100644 --- a/plinth/modules/samba/privileged.py +++ b/plinth/modules/samba/privileged.py @@ -306,3 +306,9 @@ def restore_shares(): 'Backup file {0} does not exist.'.format(SHARES_CONF_BACKUP_FILE)) _conf_command(['drop']) _conf_command(['import', SHARES_CONF_BACKUP_FILE]) + + +@privileged +def uninstall(): + """Drop all Samba shares.""" + _conf_command(['drop'])