Do not ynh_die if systemctl action fails, because we don't want to exit in the middle of a remove script ... instead, return a non-zero code which should trigger script failure only if set -eu is enabled

This commit is contained in:
Alexandre Aubin 2021-01-31 11:57:34 +01:00
parent 6b2d76dddd
commit 29fe7c3103
2 changed files with 2 additions and 4 deletions

View file

@ -32,7 +32,7 @@ ynh_wait_dpkg_free() {
if echo "$dpkg_file" | grep --perl-regexp --quiet "^[[:digit:]]+$"
then
# If so, that a remaining of dpkg.
ynh_print_err "E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem."
ynh_print_err "dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem."
set -o xtrace # set -x
return 1
fi

View file

@ -149,11 +149,9 @@ ynh_systemd_action() {
# If a log is specified for this service, show also the content of this log
if [ -e "$log_path" ]
then
ynh_print_err --message="--"
ynh_exec_err tail --lines=$length "$log_path"
fi
# Fail the app script, since the service failed.
ynh_die
return 1
fi
# Start the timeout and try to find line_match