keepalived: move alt_config_file check into process_config

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert 2020-04-29 19:32:39 +02:00 committed by Florian Eckert
parent 9b24763b9f
commit c4d1af42e8

View file

@ -95,12 +95,9 @@ print_notify() {
done done
} }
global_defs() { globals() {
local linkbeat_use_polling notification_email local linkbeat_use_polling notification_email
config_get alt_config_file "$1" alt_config_file
[ -z "$alt_config_file" ] || return 0
config_get_bool linkbeat_use_polling "$1" linkbeat_use_polling 0 config_get_bool linkbeat_use_polling "$1" linkbeat_use_polling 0
[ "$linkbeat_use_polling" -gt 0 ] && printf 'linkbeat_use_polling\n\n' >> "$KEEPALIVED_CONF" [ "$linkbeat_use_polling" -gt 0 ] && printf 'linkbeat_use_polling\n\n' >> "$KEEPALIVED_CONF"
@ -494,10 +491,7 @@ process_config() {
[ -f /etc/config/keepalived ] || return 0 [ -f /etc/config/keepalived ] || return 0
config_load 'keepalived' config_load 'keepalived'
config_get alt_config_file globals alt_config_file
config_section_open "global_defs"
config_foreach_wrapper global_defs
config_section_close
# If "alt_config_file" specified, use that instead # If "alt_config_file" specified, use that instead
[ -n "$alt_config_file" ] && [ -f "$alt_config_file" ] && { [ -n "$alt_config_file" ] && [ -f "$alt_config_file" ] && {
@ -507,6 +501,10 @@ process_config() {
return 0 return 0
} }
config_section_open "global_defs"
config_foreach_wrapper globals
config_section_close
config_section_open "static_ipaddress" config_section_open "static_ipaddress"
config_foreach_wrapper static_ipaddress config_foreach_wrapper static_ipaddress
config_section_close config_section_close