keepalived: Fix ordering of config sections

keepalived seems to be rather particular about which config parameters
come before others.

When defining a virtual IP address, keepalived will check to see if the
vrrp instance is associated with a valid interface. Previously, the
interface parameter was declared after the virtual IP address which
caused an error when keepalived tried to run this check. Keepalived
tries to fall back to checking if 'eth0' exists.

The fix is to re-order the config stanzas so that the interface
parameter comes before the virtual IP address definitions.

Signed-off-by: Ben Kelly <ben@benjii.net>
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
Ben Kelly 2016-10-04 18:41:47 +03:00 committed by Alexandru Ardelean
parent 37d9426ac5
commit 0b16c2ada2
1 changed files with 18 additions and 18 deletions

View File

@ -248,6 +248,24 @@ vrrp_instance() {
config_section_open "vrrp_instance" "$name"
config_get auth_type $1 auth_type
config_get auth_pass $1 auth_pass
[ -n "$auth_type" -a -n "$auth_pass" ] && {
printf "${INDENT_1}authentication {\n" >> $KEEPALIVED_CONF
printf "${INDENT_2}auth_type $auth_type\n" >> $KEEPALIVED_CONF
printf "${INDENT_2}auth_pass $auth_pass\n" >> $KEEPALIVED_CONF
printf "$INDENT_1}\n" >> $KEEPALIVED_CONF
}
print_elems_indent $1 $INDENT_1 use_vmac state interface \
mcast_src_ip unicast_src_ip virtual_router_id version priority \
advert_int preempt_delay debug notify_backup \
notify_master notify_fault notify_stop notify \
lvs_sync_daemon_interface garp_master_delay garp_master_refresh \
garp_master_repeat garp_master_refresh_repeat \
no_val_vmac_xmit_base no_val_native_ipv6 no_val_accept \
no_val_dont_track_primary no_val_smtp_alert no_val_nopreempt
# Handle virtual_ipaddress & virtual_ipaddress_excluded lists
for opt in virtual_ipaddress virtual_ipaddress_excluded; do
config_get $opt $1 $opt
@ -291,24 +309,6 @@ vrrp_instance() {
done
unset optval
config_get auth_type $1 auth_type
config_get auth_pass $1 auth_pass
[ -n "$auth_type" -a -n "$auth_pass" ] && {
printf "${INDENT_1}authentication {\n" >> $KEEPALIVED_CONF
printf "${INDENT_2}auth_type $auth_type\n" >> $KEEPALIVED_CONF
printf "${INDENT_2}auth_pass $auth_pass\n" >> $KEEPALIVED_CONF
printf "$INDENT_1}\n" >> $KEEPALIVED_CONF
}
print_elems_indent $1 $INDENT_1 use_vmac state interface \
mcast_src_ip unicast_src_ip virtual_router_id version priority \
advert_int preempt_delay debug notify_backup \
notify_master notify_fault notify_stop notify \
lvs_sync_daemon_interface garp_master_delay garp_master_refresh \
garp_master_repeat garp_master_refresh_repeat \
no_val_vmac_xmit_base no_val_native_ipv6 no_val_accept \
no_val_dont_track_primary no_val_smtp_alert no_val_nopreempt
config_section_close
}