diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2009-03-08 17:47:40 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2009-03-08 17:47:40 -0700 |
commit | a64dfc6524f0d59f4c7c0df4d2d6d30679791909 (patch) | |
tree | df464479eb95b1ad40555c260406f05a9fb351b1 /scripts/keepalived | |
parent | 084e7f10bdcd701c4d2643e5ed286c3d824ba975 (diff) | |
download | vyatta-cfg-system-a64dfc6524f0d59f4c7c0df4d2d6d30679791909.tar.gz vyatta-cfg-system-a64dfc6524f0d59f4c7c0df4d2d6d30679791909.zip |
Fix 4183: No auto completion for group number when running 'clear vrrp
master interface <ifname> group <group-num>'
Diffstat (limited to 'scripts/keepalived')
-rwxr-xr-x | scripts/keepalived/vyatta-keepalived.pl | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/scripts/keepalived/vyatta-keepalived.pl b/scripts/keepalived/vyatta-keepalived.pl index fa82b023..7d5e6ed7 100755 --- a/scripts/keepalived/vyatta-keepalived.pl +++ b/scripts/keepalived/vyatta-keepalived.pl @@ -383,6 +383,45 @@ sub keepalived_write_file { close $fh; } +sub list_vrrp_intf { + my $config = new Vyatta::Config; + my @intfs = (); + + $config->setLevel("interfaces ethernet"); + my @eths = $config->listOrigNodes(); + foreach my $eth (@eths) { + my $path = "interfaces ethernet $eth"; + $config->setLevel($path); + push @intfs, $eth if $config->existsOrig("vrrp"); + if ($config->existsOrig("vif")) { + my $path = "interfaces ethernet $eth vif"; + $config->setLevel($path); + my @vifs = $config->listOrigNodes(); + foreach my $vif (@vifs) { + my $vif_intf = $eth . "." . $vif; + my $vif_path = "$path $vif"; + $config->setLevel($vif_path); + push @intfs, $vif_intf if $config->existsOrig("vrrp"); + } + } + } + return @intfs; +} + +sub list_vrrp_group { + my ($name) = @_; + + my $config = new Vyatta::Config; + my $path = "interfaces ethernet $name"; + if ($name =~ /(eth\d+)\.(\d+)/) { + $path = "interfaces ethernet $1 vif $2"; + } + $path .= " vrrp vrrp-group"; + $config->setLevel($path); + my @groups = $config->listOrigNodes(); + return @groups; +} + # # main @@ -450,6 +489,22 @@ if ($action eq "check-vip") { exit 0; } +if ($action eq "list-vrrp-intf") { + my @intfs = list_vrrp_intf(); + print join(' ', @intfs); + exit 0; +} + +if ($action eq "list-vrrp-group") { + if (! defined $vrrp_intf) { + print "must include interface\n"; + exit 1; + } + my @groups = list_vrrp_group($vrrp_intf); + print join(' ', @groups); + exit 0; +} + exit 0; # end of file |