summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@io.vyatta.com>2009-03-06 16:57:46 -0800
committerStig Thormodsrud <stig@io.vyatta.com>2009-03-06 16:57:46 -0800
commit15cfd538a2ce7c876dcd70754a83f036cb24347d (patch)
treeb0433fe2d4ed80705129b253c86e3c1b94ddaf6f
parent0d7f4690fe9b6d75bdd385f63707f7600ae89b80 (diff)
downloadvyatta-cfg-quagga-15cfd538a2ce7c876dcd70754a83f036cb24347d.tar.gz
vyatta-cfg-quagga-15cfd538a2ce7c876dcd70754a83f036cb24347d.zip
Move changes file to /var/run/vrrpd and make sure the directory exists.
-rwxr-xr-xlib/Vyatta/Keepalived.pm9
-rwxr-xr-xscripts/keepalived/vyatta-keepalived.pl6
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/Vyatta/Keepalived.pm b/lib/Vyatta/Keepalived.pm
index fafaafe1..00a14f95 100755
--- a/lib/Vyatta/Keepalived.pm
+++ b/lib/Vyatta/Keepalived.pm
@@ -23,7 +23,7 @@
#
package Vyatta::Keepalived;
our @EXPORT = qw(get_conf_file get_state_script get_state_file
- vrrp_log vrrp_get_init_state
+ vrrp_log vrrp_get_init_state get_changes_file
start_daemon restart_daemon stop_daemon);
use base qw(Exporter);
@@ -40,7 +40,7 @@ my $state_transition = "$sbin_dir/vyatta-vrrp-state.pl";
my $keepalived_pid = '/var/run/keepalived_vrrp.pid';
my $state_dir = '/var/run/vrrpd';
my $vrrp_log = "$state_dir/vrrp.log";
-
+my $changes_file = "$state_dir/changes";
sub vrrp_log {
my $timestamp = strftime("%Y%m%d-%H:%M.%S", localtime);
@@ -104,6 +104,11 @@ sub get_state_script {
return $state_transition;
}
+sub get_changes_file {
+ system("mkdir $state_dir") if ! -d $state_dir;
+ return $changes_file;
+}
+
sub get_state_file {
my ($vrrp_intf, $vrrp_group) = @_;
diff --git a/scripts/keepalived/vyatta-keepalived.pl b/scripts/keepalived/vyatta-keepalived.pl
index d151b605..fa82b023 100755
--- a/scripts/keepalived/vyatta-keepalived.pl
+++ b/scripts/keepalived/vyatta-keepalived.pl
@@ -34,9 +34,7 @@ use Getopt::Long;
use strict;
use warnings;
-my $changes_file = '/var/log/vrrpd/changes';
-my $conf_file = get_conf_file();
-
+my ($conf_file, $changes_file);
my %HoA_sync_groups;
sub validate_source_addr {
@@ -402,6 +400,8 @@ if (! defined $action) {
}
if ($action eq "update") {
+ $changes_file = get_changes_file();
+ $conf_file = get_conf_file();
vrrp_log("vrrp update $vrrp_intf");
if ( ! -e $changes_file) {
my $num_changes = vrrp_find_changes();