mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
action_utils: Stop associated service when stopping a socket unit
Tests: - Unit tests pass. - Radicale and Bepasty functional tests pass with changes to migrate to new systemd socket-activated units. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
65fecdc4cd
commit
7cbbc3633b
@ -123,6 +123,14 @@ def service_disable(service_name: str, check: bool = False):
|
|||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if service_name.endswith('.socket'):
|
||||||
|
# Instead, may need to query the unit for associated .service file.
|
||||||
|
base_name = service_name.rpartition('.')[0]
|
||||||
|
try:
|
||||||
|
service_stop(f'{base_name}.service', check=check)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def service_mask(service_name: str, check: bool = False):
|
def service_mask(service_name: str, check: bool = False):
|
||||||
"""Mask a service"""
|
"""Mask a service"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user