diff options
author | Robert Bays <robert@vyatta.com> | 2010-08-12 18:27:40 -0700 |
---|---|---|
committer | Robert Bays <robert@vyatta.com> | 2010-08-12 18:27:40 -0700 |
commit | 78681dc9134ae490fb67ba1fd1f627114fcdc0b5 (patch) | |
tree | 74158dae1cf8a180aaef99baa3fce000a921e60d | |
parent | 493f06c66621e7c652a95a0084d911d6901ef406 (diff) | |
download | vyatta-cfg-quagga-78681dc9134ae490fb67ba1fd1f627114fcdc0b5.tar.gz vyatta-cfg-quagga-78681dc9134ae490fb67ba1fd1f627114fcdc0b5.zip |
fix for bug 6034
-rw-r--r-- | lib/Vyatta/Quagga/Config.pm | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/lib/Vyatta/Quagga/Config.pm b/lib/Vyatta/Quagga/Config.pm index bf45c891..a24838f1 100644 --- a/lib/Vyatta/Quagga/Config.pm +++ b/lib/Vyatta/Quagga/Config.pm @@ -342,9 +342,8 @@ sub _qtree { $qcom = $_qcomref; - # It's ugly that I have to create a new Vyatta config object every time, - # but something gets messed up on the stack if I don't. not sure - # what yet. would love to reference a global config and just reset Level. + # Would love to reference a global config and just reset Levels, + # but Vyatta::Config isn't recursion safe. my $config = new Vyatta::Config; $config->setLevel($level); @@ -356,7 +355,28 @@ sub _qtree { else { $vtysh = \%_vtyshdel; @nodes = $config->listDeleted(); - } + + # handle special case for multi-nodes values being deleted + # listDeleted() doesn't return the node as deleted if it is a multi + # unless all values are deleted. + # TODO: fix listDeleted() in Config.pm + # This is really, really fugly. + my @all_nodes = $config->listNodes(); + foreach my $node (@all_nodes) { + my @array = split /\s+/, $level; + push @array, $node; + my ($multi, $text, $default) = $config->parseTmpl(\@array); + if ($multi) { + my @orig_values = $config->returnOrigValues("$node"); + my @new_values = $config->returnValues("$node"); + my %chash = $config->compareValueLists(\@orig_values, \@new_values); + if ($chash{'deleted'}) { + push @nodes, $node; + } + } + } + + } ## end else { if ($_DEBUG) { print "DEBUG: _qtree - action: $action\tlevel: $level\n"; } |