diff options
-rwxr-xr-x | scripts/keepalived/VyattaKeepalived.pm | 6 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/vrrp/node.def | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/scripts/keepalived/VyattaKeepalived.pm b/scripts/keepalived/VyattaKeepalived.pm index c8d732d1..f7e62b19 100755 --- a/scripts/keepalived/VyattaKeepalived.pm +++ b/scripts/keepalived/VyattaKeepalived.pm @@ -136,7 +136,11 @@ sub vrrp_get_config { my $config = new VyattaConfig; $config->setLevel("interfaces ethernet $intf"); - my $primary_addr = $config->returnOrigValue("address"); + my $primary_addr = $config->returnOrigValue("address"); + if (!defined $primary_addr) { + $primary_addr = "0.0.0.0"; + } + if ($primary_addr =~ m/(\d+\.\d+\.\d+\.\d+)\/\d+/) { $primary_addr = $1; } diff --git a/templates/interfaces/ethernet/node.tag/vrrp/node.def b/templates/interfaces/ethernet/node.tag/vrrp/node.def index 38622243..de3253a5 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/node.def @@ -1,4 +1,5 @@ help: "Configure VRRP" -commit: $(virtual-address/@) != ""; "must define the virtual-address" +commit: $(../address/) != ""; "Must define a primary IP address on $(../@)" +commit: $(virtual-address/) != ""; "Must define the virtual-address for vrrp-group $(../vrrp-group/@)" end: "sudo /opt/vyatta/sbin/vyatta-keepalived.pl --vrrp-action update --intf $(../@) " |