From 711c19b511f969d0dce5c36221428e8caa0e7473 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sat, 21 Sep 2024 08:47:21 -0400 Subject: [PATCH] action_utils: Add a method to reset services in 'failed' state Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/action_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plinth/action_utils.py b/plinth/action_utils.py index a823f8e3b..7e53c90ad 100644 --- a/plinth/action_utils.py +++ b/plinth/action_utils.py @@ -143,6 +143,12 @@ def service_try_reload_or_restart(service_name): service_action(service_name, 'try-reload-or-restart') +def service_reset_failed(service_name): + """Reset the 'failed' state of units.""" + service_action(service_name, 'reset-failed') + + + def service_action(service_name, action): """Perform the given action on the service_name.""" subprocess.run(['systemctl', action, service_name],