apache: Use privileged decorator for actions

Tests:

- Initial setup works when a new container is created
- When transmission is enabled/disabled, the web configuration for it is
  enabled/disabled.
- When radicale is enabled/disabled, the uwsgi configuration for it is
  enabled/disabled.
- Sharing web configuration is disabled during backup and re-enabled.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2022-10-08 18:51:15 -04:00
1 parent fdbe537529
commit 3e2900b48b
6 files changed
+66 -120

No files matched your search

+3 -6
View File
@@ -15,6 +15,7 @@ import logging
from plinth import action_utils, actions
from plinth import app as app_module
from plinth import setup
from plinth.modules.apache import privileged as apache_privileged
from .components import BackupRestore
@@ -340,16 +341,12 @@ class ApacheServiceHandler(ServiceHandler):
self.was_enabled = action_utils.webserver_is_enabled(
self.web_name, kind=self.kind)
if self.was_enabled:
actions.superuser_run(
'apache',
['disable', '--name', self.web_name, '--kind', self.kind])
apache_privileged.disable(self.web_name, self.kind)
def restart(self):
"""Restart the service if it was earlier running."""
if self.was_enabled:
actions.superuser_run(
'apache',
['enable', '--name', self.web_name, '--kind', self.kind])
apache_privileged.enable(self.web_name, self.kind)
def _shutdown_services(components):