sharing: Completely uninstall app

Test: Functional tests passed

Signed-off-by: nbenedek <contact@nbenedek.me>
[sunil: Update docstrings, make uninstall fail-safe]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
nbenedek 2023-04-07 03:18:52 +02:00 committed by Sunil Mohan Adapa
parent 95e370a1bf
commit 77318806c2
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 11 additions and 0 deletions

View File

@ -55,3 +55,8 @@ class SharingApp(app_module.App):
super().setup(old_version)
privileged.setup()
self.enable()
def uninstall(self):
"""De-configure and uninstall the app."""
super().uninstall()
privileged.uninstall()

View File

@ -173,3 +173,9 @@ def _list(aug=None):
def list_shares() -> list[dict[str, object]]:
"""List all Apache configuration shares and print as JSON."""
return _list()
@privileged
def uninstall():
"""Remove apache config when app is uninstalled."""
pathlib.Path(APACHE_CONFIGURATION).unlink(missing_ok=True)