From 4d7651c89f44e9b12bc880114ed5f6c482cc888f Mon Sep 17 00:00:00 2001 From: nbenedek Date: Sat, 15 Apr 2023 14:45:49 +0200 Subject: [PATCH] openvpn: Completely uninstall app Remove /etc/openvpn when the app is uninstalled * Tests: 1. Uninstall app and manually check if /etc/openvpn gets removed 2. Sucessfully install app 3. Functional tests: passed 4. In case we choose to purge packages in the future: I checked purging openvpn and it will not remove /etc/openvpn. Signed-off-by: nbenedek [sunil: Update docstrings] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- plinth/modules/openvpn/__init__.py | 5 +++++ plinth/modules/openvpn/privileged.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/plinth/modules/openvpn/__init__.py b/plinth/modules/openvpn/__init__.py index 832723573..40991a7b2 100644 --- a/plinth/modules/openvpn/__init__.py +++ b/plinth/modules/openvpn/__init__.py @@ -91,3 +91,8 @@ class OpenVPNApp(app_module.App): super().setup(old_version) privileged.setup() self.enable() + + def uninstall(self): + """De-configure and uninstall the app.""" + super().uninstall() + privileged.uninstall() diff --git a/plinth/modules/openvpn/privileged.py b/plinth/modules/openvpn/privileged.py index e33c7c541..aaf0432d3 100644 --- a/plinth/modules/openvpn/privileged.py +++ b/plinth/modules/openvpn/privileged.py @@ -2,6 +2,7 @@ """Configure OpenVPN server.""" import os +import shutil import subprocess import augeas @@ -222,3 +223,9 @@ def load_augeas(): aug.set('/augeas/load/Simplevars/incl[last() + 1]', ATTR_FILE) aug.load() return aug + + +@privileged +def uninstall(): + """Remove configuration directory for OpenVPN.""" + shutil.rmtree('/etc/openvpn', ignore_errors=True)