diff options
Diffstat (limited to 'scripts/VyattaConfig.pm')
-rwxr-xr-x | scripts/VyattaConfig.pm | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/scripts/VyattaConfig.pm b/scripts/VyattaConfig.pm index 1c0eaf3..941bb63 100755 --- a/scripts/VyattaConfig.pm +++ b/scripts/VyattaConfig.pm @@ -130,8 +130,43 @@ sub listOrigNodes { $tmp =~ s/\n//g; $tmp =~ s/%2F/\//g; #print "DEBUG VyattaConfig->listNodes(): node = $tmp\n"; + push @nodes_modified, $tmp; + } + + 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; + push @nodes_modified, $tmp; } } |