diff options
author | Michael Larson <slioch@eng-140.vyatta.com> | 2008-07-11 13:36:02 -0700 |
---|---|---|
committer | Michael Larson <slioch@eng-140.vyatta.com> | 2008-07-11 13:36:02 -0700 |
commit | 3f41fcca673762ff27328192036719eace6b6495 (patch) | |
tree | aac791f1da45d857ac3c19b77cafa1c54b9aab09 /scripts | |
parent | b72c49e6aec5c5d80b8e0192658308c339b07404 (diff) | |
download | vyatta-cfg-3f41fcca673762ff27328192036719eace6b6495.tar.gz vyatta-cfg-3f41fcca673762ff27328192036719eace6b6495.zip |
fix for bug 3441. Selective stripping of the 'def' only needs to occur in one location.
hease enter the commit message for your changes.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/VyattaConfig.pm | 37 | ||||
-rwxr-xr-x | scripts/VyattaConfigOutput.pm | 2 |
2 files changed, 38 insertions, 1 deletions
diff --git a/scripts/VyattaConfig.pm b/scripts/VyattaConfig.pm index 3c4b51f..941bb63 100755 --- a/scripts/VyattaConfig.pm +++ b/scripts/VyattaConfig.pm @@ -136,6 +136,43 @@ sub listOrigNodes { return @nodes_modified; } +## listOrigNodes("level") +# return array of all original nodes (i.e., before any current change; i.e., +# in "working") at "level" +# level is relative +sub listOrigNodesNoDef { + my ($self, $path) = @_; + my @nodes = (); + + if (defined $path) { + $path =~ s/\//%2F/g; + $path =~ s/\s+/\//g; + $path = $self->{_active_dir_base} . $self->{_current_dir_level} . "/" + . $path; + } + else { + $path = $self->{_active_dir_base} . $self->{_current_dir_level}; + } + + #print "DEBUG VyattaConfig->listNodes(): path = $path\n"; + opendir DIR, "$path" or return (); + @nodes = grep !/^\./, readdir DIR; + closedir DIR; + + my @nodes_modified = (); + while (@nodes) { + my $tmp = pop (@nodes); + $tmp =~ s/\n//g; + $tmp =~ s/%2F/\//g; + #print "DEBUG VyattaConfig->listNodes(): node = $tmp\n"; + if ($tmp ne 'def') { + push @nodes_modified, $tmp; + } + } + + return @nodes_modified; +} + ## returnParent("level") # return the name of parent node relative to the current hierarchy # in this case "level" is set to the parent dir ".. .." diff --git a/scripts/VyattaConfigOutput.pm b/scripts/VyattaConfigOutput.pm index 5358c21..1933d22 100755 --- a/scripts/VyattaConfigOutput.pm +++ b/scripts/VyattaConfigOutput.pm @@ -189,7 +189,7 @@ sub displayDeletedOrigChildren { } my $is_tag = $config->isTagNode([ @cur_path, $child ]); $config->setLevel(join ' ', (@cur_path, $child)); - my @cnames = sort $config->listOrigNodes(); + my @cnames = sort $config->listOrigNodesNoDef(); if ($cnames[0] eq 'node.val') { displayValues([ @cur_path, $child ], $prefix, $child, |