summaryrefslogtreecommitdiff
path: root/scripts/keepalived/vyatta-keepalived.pl
diff options
context:
space:
mode:
authorMohit Mehta <mohit@vyatta.com>2008-03-20 16:30:08 -0700
committerMohit Mehta <mohit@vyatta.com>2008-03-20 16:30:08 -0700
commit814b58b62fcb20c45f0a8e31f6f09e308aabc39f (patch)
tree4fff8ec80e2c106f5268400f528d2e7a9ac695f5 /scripts/keepalived/vyatta-keepalived.pl
parentf8620172d349b7892fdb56ee9a98a549e849b9ed (diff)
downloadvyatta-cfg-system-814b58b62fcb20c45f0a8e31f6f09e308aabc39f.tar.gz
vyatta-cfg-system-814b58b62fcb20c45f0a8e31f6f09e308aabc39f.zip
Fix Bug 2778 VRRP: add ability to run scripts on state transition
- enhancement added: configuring of scripts to run on vrrp state-transitions
Diffstat (limited to 'scripts/keepalived/vyatta-keepalived.pl')
-rwxr-xr-xscripts/keepalived/vyatta-keepalived.pl21
1 files changed, 18 insertions, 3 deletions
diff --git a/scripts/keepalived/vyatta-keepalived.pl b/scripts/keepalived/vyatta-keepalived.pl
index 1deeafe8..0f1301db 100755
--- a/scripts/keepalived/vyatta-keepalived.pl
+++ b/scripts/keepalived/vyatta-keepalived.pl
@@ -81,6 +81,21 @@ sub keepalived_get_values {
}
}
+ $config->setLevel("$path vrrp vrrp-group $group run-transition-scripts");
+ my $run_backup_script = $config->returnValue("backup");
+ if(!defined $run_backup_script){
+ $run_backup_script = "null";
+ }
+ my $run_fault_script = $config->returnValue("fault");
+ if(!defined $run_fault_script){
+ $run_fault_script = "null";
+ }
+ my $run_master_script = $config->returnValue("master");
+ if(!defined $run_master_script){
+ $run_master_script = "null";
+ }
+
+
$output .= "vrrp_instance $vrrp_instance \{\n";
if ($preempt eq "false") {
$output .= "\tstate BACKUP\n";
@@ -105,11 +120,11 @@ sub keepalived_get_values {
}
$output .= "\t\}\n";
$output .= "\tnotify_master ";
- $output .= "\"$state_transition_script master $intf $group @vips\" \n";
+ $output .= "\"$state_transition_script master $intf $group $run_master_script @vips\" \n";
$output .= "\tnotify_backup ";
- $output .= "\"$state_transition_script backup $intf $group @vips\" \n";
+ $output .= "\"$state_transition_script backup $intf $group $run_backup_script @vips\" \n";
$output .= "\tnotify_fault ";
- $output .= "\"$state_transition_script fault $intf $group @vips\" \n";
+ $output .= "\"$state_transition_script fault $intf $group $run_fault_script @vips\" \n";
$output .= "\}\n";
}