diff options
-rwxr-xr-x | lib/Vyatta/Keepalived.pm | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/Vyatta/Keepalived.pm b/lib/Vyatta/Keepalived.pm index c34d277..13966c5 100755 --- a/lib/Vyatta/Keepalived.pm +++ b/lib/Vyatta/Keepalived.pm @@ -152,21 +152,11 @@ sub vrrp_get_config { my $path; my $config = new Vyatta::Config; - - if ($intf =~ m/bond/) { - if ($intf =~ m/(bond\d+)\.(\d+)/) { - $path = "interfaces bonding $1 vif $2"; - } else { - $path = "interfaces bonding $intf"; - } - } else { - if ($intf =~ m/(eth\d+)\.(\d+)/) { - $path = "interfaces ethernet $1 vif $2"; - } else { - $path = "interfaces ethernet $intf"; - } - } + my $interface = new Vyatta::Interface($intf); + die "Unknown interface type: $intf" unless $interface; + + $path = $interface->path(); $config->setLevel($path); my $primary_addr = $config->returnOrigValue("address"); if (!defined $primary_addr) { |