diff options
author | slioch <slioch@eng-140.vyatta.com> | 2009-06-29 12:59:09 -0700 |
---|---|---|
committer | slioch <slioch@eng-140.vyatta.com> | 2009-07-06 13:38:05 -0700 |
commit | d324b9b9d1f7c96283a63cb06cce9f9e4acc5cd5 (patch) | |
tree | cfcbd3e5721038eb0da93549dc94efc618a6b3b6 /lib | |
parent | c3b23a060d2c949580873dc100469be9ad05734c (diff) | |
download | vyatta-cfg-d324b9b9d1f7c96283a63cb06cce9f9e4acc5cd5.tar.gz vyatta-cfg-d324b9b9d1f7c96283a63cb06cce9f9e4acc5cd5.zip |
bugsfixed in active+working node merge for perl api.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Vyatta/Config.pm | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm index ba3cd6c..fd0222f 100755 --- a/lib/Vyatta/Config.pm +++ b/lib/Vyatta/Config.pm @@ -124,27 +124,44 @@ sub listOrigPlusComNodes { #$node[1] is of the form: system/login/blah #$coll is of the form: blah + my $dir_path = $level; + $dir_path =~ s/ /\//g; + $dir_path = "/".$dir_path; + +# print("comparing: $dir_path and $level to $node[1]\n"); + #first only consider $path matches against $node[1] - if (!defined $level || $node[1] =~ m/^$level/) { + if (!defined $dir_path || $node[1] =~ m/^$dir_path/) { #or does $node[1] match the beginning of the line for $path #if yes, then split the right side and find against the hash for the value... my $tmp; - if (defined $level) { - $tmp = substr($node[1],length($level)+1); + if (defined $dir_path) { + $tmp = substr($node[1],length($dir_path)); } else { $tmp = $node[1]; } + + my @child = split "/",$tmp; + my $child; +# print("tmp: $tmp, $child[0], $child[1]\n"); + if ($child[0] =~ /^\s*$/ || !defined $child[0] || $child[0] eq '') { + shift(@child); + } + +# print("child value is: >$child[0]<\n"); #now can we find this entry in the hash? #if '-' this is a delete and need to remove from hash if ($node[0] eq "-") { - delete($coll{$tmp}); + if (!defined $child[1]) { + delete($coll{$child[0]}); + } } #if '+' this is a set and need to add to hash - elsif ($node[0] eq "+") { - $coll{$tmp} = '1'; + elsif ($node[0] eq "+" && $child[0] ne '') { + $coll{$child[0]} = '1'; } } } |