syncthing: Completely uninstall app

Remove config file when app is uninstalled

Tests:
1. Install app and add a share
2. Reinstall app and confirm that the share doesn't exist

The order of the functional tests should be modified
since 'test_add_remove_folder' fails

Signed-off-by: nbenedek <contact@nbenedek.me>
[sunil: Update docstrings, make uninstall fail-safe]
[sunil: Remove the entire configuration directory]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
nbenedek authored and Sunil Mohan Adapa committed 2023-04-14 17:11:31 +05:30
1 parent 77318806c2
commit f1d2139c2d
2 files changed
+12

No files matched your search

+5
View File
@@ -143,3 +143,8 @@ class SyncthingApp(app_module.App):
sharing.remove_share(name)
sharing.add_share(name, share['path'], new_groups,
share['is_public'])
def uninstall(self):
"""De-configure and uninstall the app."""
super().uninstall()
privileged.uninstall()
+7
View File
@@ -3,6 +3,7 @@
import grp
import os
import pathlib
import pwd
import shutil
import subprocess
@@ -80,3 +81,9 @@ def setup_config():
if conf_changed:
action_utils.service_try_restart('syncthing@syncthing')
@privileged
def uninstall():
"""Remove configuration file when app is uninstalled."""
shutil.rmtree(DATA_DIR + '/.config', ignore_errors=True)