From db2d42c5ac79183d98969b84e5e4656f3d2dbf67 Mon Sep 17 00:00:00 2001 From: nbenedek Date: Mon, 3 Apr 2023 22:33:41 +0200 Subject: [PATCH] coturn: Completely uninstall app Tests: * Verify from the UI that after reinstalling the app a new secret is generated * Functional tests passed Signed-off-by: nbenedek [sunil: Update docstrings, make uninstall fail-safe] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- plinth/modules/coturn/__init__.py | 5 +++++ plinth/modules/coturn/privileged.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/plinth/modules/coturn/__init__.py b/plinth/modules/coturn/__init__.py index d3b549d52..1eebd4c34 100644 --- a/plinth/modules/coturn/__init__.py +++ b/plinth/modules/coturn/__init__.py @@ -114,6 +114,11 @@ class CoturnApp(app_module.App): self.get_component('letsencrypt-coturn').setup_certificates() notify_configuration_change() + def uninstall(self): + """De-configure and uninstall the app.""" + super().uninstall() + privileged.uninstall() + def get_available_domains(): """Return an iterator with all domains able to have a certificate.""" diff --git a/plinth/modules/coturn/privileged.py b/plinth/modules/coturn/privileged.py index 14f75feb4..fdf8fbfd9 100644 --- a/plinth/modules/coturn/privileged.py +++ b/plinth/modules/coturn/privileged.py @@ -89,3 +89,9 @@ def augeas_load(): aug.load() return aug + + +@privileged +def uninstall(): + """Remove configuration file.""" + CONFIG_FILE.unlink(missing_ok=True)