keepalived: move alt_config_file check into process_config
authorFlorian Eckert <fe@dev.tdt.de>
Wed, 29 Apr 2020 17:32:39 +0000 (19:32 +0200)
committerFlorian Eckert <Eckert.Florian@googlemail.com>
Mon, 4 May 2020 07:07:00 +0000 (09:07 +0200)
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
net/keepalived/files/keepalived.init

index cf425e87227ab86717f8144fe775a2bf38044da5..a90bf6d0b126a416139889db84a693aa7285869c 100644 (file)
@@ -95,12 +95,9 @@ print_notify() {
        done
 }
 
-global_defs() {
+globals() {
        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
        [ "$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
        config_load 'keepalived'
-
-       config_section_open "global_defs"
-       config_foreach_wrapper global_defs
-       config_section_close
+       config_get alt_config_file globals alt_config_file
 
        # If "alt_config_file" specified, use that instead
        [ -n "$alt_config_file" ] && [ -f "$alt_config_file" ] && {
@@ -507,6 +501,10 @@ process_config() {
                return 0
        }
 
+       config_section_open "global_defs"
+       config_foreach_wrapper globals
+       config_section_close
+
        config_section_open "static_ipaddress"
        config_foreach_wrapper static_ipaddress
        config_section_close