summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Balocca <rbalocca@vyatta.com>2008-07-15 14:23:54 -0700
committerRick Balocca <rbalocca@vyatta.com>2008-07-15 14:23:54 -0700
commit5203e1fafc937098a514164db30857e32283c000 (patch)
treeaac791f1da45d857ac3c19b77cafa1c54b9aab09
parent7afb31102689ebb71da4a08f92de59249c55d80b (diff)
parent3f41fcca673762ff27328192036719eace6b6495 (diff)
downloadvyatta-cfg-5203e1fafc937098a514164db30857e32283c000.tar.gz
vyatta-cfg-5203e1fafc937098a514164db30857e32283c000.zip
Merge branch 'hollywood'
-rwxr-xr-xscripts/VyattaConfig.pm37
-rwxr-xr-xscripts/VyattaConfigLoad.pm3
-rwxr-xr-xscripts/VyattaConfigOutput.pm8
3 files changed, 44 insertions, 4 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;
}
}
diff --git a/scripts/VyattaConfigLoad.pm b/scripts/VyattaConfigLoad.pm
index c8563bb..1a7f26e 100755
--- a/scripts/VyattaConfigLoad.pm
+++ b/scripts/VyattaConfigLoad.pm
@@ -297,6 +297,9 @@ sub findDeletedNodes {
$active_cfg->setLevel(join ' ', @active_path);
my @active_nodes = $active_cfg->listOrigNodes();
foreach (@active_nodes) {
+ if ($_ eq 'def') {
+ next;
+ }
if ($_ eq 'node.val') {
findDeletedValues($new_ref, \@active_path);
next;
diff --git a/scripts/VyattaConfigOutput.pm b/scripts/VyattaConfigOutput.pm
index ab7068f..1933d22 100755
--- a/scripts/VyattaConfigOutput.pm
+++ b/scripts/VyattaConfigOutput.pm
@@ -138,7 +138,7 @@ sub displayValues {
my @cnames = sort keys %cnodes;
if (defined($simple_show)) {
- if ($show_all) {
+ if (!$cnodes{'def'} || $show_all) {
if ($is_password && $hide_password) {
$oval = $HIDE_PASSWORD;
}
@@ -159,7 +159,7 @@ sub displayValues {
$diff = '>';
}
}
- if ($show_all) {
+ if (!$cnodes{'def'} || $show_all) {
if ($is_password && $hide_password) {
$value = $HIDE_PASSWORD;
}
@@ -189,11 +189,13 @@ 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,
$dont_show_as_deleted);
+ } elsif ($cnames[0] eq 'def') {
+ #ignore
} elsif (scalar($#cnames) >= 0) {
if ($is_tag) {
@cnames = sort versioncmp @cnames;