Skip to content

Commit

Permalink
Add functionality for keepalived notify script
Browse files Browse the repository at this point in the history
Signed-off-by: Rémi PAETA <[email protected]>
  • Loading branch information
remipcomaite authored and rsmontero committed Apr 26, 2023
1 parent da92a5f commit f598846
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/etc/one-context.d/loc-15-keepalived##vr
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ get_check_script() {
echo $script
}

get_notify_script() {
notify_script="$VROUTER_KEEPALIVED_NOTIFY_SCRIPT"

echo $notify_script
}

get_iface_var() {
var_name="$1_$2"
var=$(eval "echo \"\${$var_name}\"")
Expand Down Expand Up @@ -133,6 +139,16 @@ EOT
fi
}

gen_notify_script() {
notify_script="$(get_notify_script)"

if [ -n "$notify_script" ]; then
cat <<EOT
notify "$notify_script"
EOT
fi
}

gen_preempt() {
script="$(get_check_script)"

Expand Down Expand Up @@ -160,6 +176,7 @@ vrrp_instance $interface {
$(gen_auth)
$(gen_track)
$(gen_preempt)
$(gen_notify_script)
}
EOT
Expand Down

0 comments on commit f598846

Please sign in to comment.