From b3409729a6dafa75276bab975669855392bbfaa7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 23 Jun 2024 14:36:55 +0200 Subject: [PATCH] helpers2.1: when using ynh_systemctl to reload/start/restart a service with a wait_until and it timesout, handle it as a filure rather than keep going --- helpers/helpers.v2.1.d/systemd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/helpers/helpers.v2.1.d/systemd b/helpers/helpers.v2.1.d/systemd index 259f25862..0c0be3e67 100644 --- a/helpers/helpers.v2.1.d/systemd +++ b/helpers/helpers.v2.1.d/systemd @@ -162,6 +162,13 @@ ynh_systemctl() { ynh_print_warn "===" tail --lines=$length "$log_path" >&2 fi + + # If we tried to reload/start/restart the service but systemctl consider it to be still inactive/broken, then handle it as a failure + if ([ "$action" == "reload" ] || [ "$action" == "start" ] || [ "$action" == "restart" ]) && ! systemctl --quiet is-active $service + then + _ynh_clean_check_starting + return 1 + fi fi _ynh_clean_check_starting fi