keepalived: fix ambigiuos functions in hotplug.sh

When "set_reload_if_sync" is not set in the hotplug script, the service
is not expected to reload. That is not true because even if not set, the
value is set to the default 1 (reload active) or equals the parameter
set when "keepalived_hotplug" is called.
The default behavior should be:
    - Reload if set_reload_if_sync is called
    - NOT reload if set_reload_if_sync is NOT called
A similar fix is ported to "set_update_target".

Signed-off-by: Francesco Benini <francy.benini@gmail.com>
pull/25188/head
Francesco Benini 2024-10-20 01:19:23 +02:00 committed by Florian Eckert
parent ea092363d9
commit ac72a52fd9
2 changed files with 11 additions and 7 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=keepalived
PKG_VERSION:=2.2.8
PKG_RELEASE:=8
PKG_RELEASE:=9
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.keepalived.org/software

View File

@ -82,7 +82,7 @@ is_sync_file() {
list_contains SYNC_FILES_LIST "$1"
}
set_update_target() {
_set_update_target() {
set_var UPDATE_TARGET "${1:-1}"
}
@ -90,8 +90,8 @@ get_update_target() {
get_var UPDATE_TARGET
}
unset_update_target() {
set_var UPDATE_TARGET
set_disable_update_target() {
_set_update_target 0
}
is_update_target() {
@ -170,8 +170,12 @@ skip_running_check() {
get_var_flag NOTIFY_SKIP_RUNNING
}
_set_reload_if_sync() {
set_var NOTIFY_SYNC_RELOAD "${1:-0}"
}
set_reload_if_sync() {
set_var NOTIFY_SYNC_RELOAD "${1:-1}"
_set_reload_if_sync 1
}
get_reload_if_sync() {
@ -257,8 +261,8 @@ keepalived_hotplug() {
[ -z "$(get_fault_cb)" ] && set_fault_cb _notify_fault
[ -z "$(get_sync_cb)" ] && set_sync_cb _notify_sync
[ -z "$(get_update_target)" ] && set_update_target "$@"
[ -z "$(get_reload_if_sync)" ] && set_reload_if_sync "$@"
[ -z "$(get_update_target)" ] && _set_update_target "$@"
[ -z "$(get_reload_if_sync)" ] && _set_reload_if_sync "$@"
case $ACTION in
NOTIFY_MASTER) call_cb "$(get_master_cb)" ;;