summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2008-07-07 14:35:36 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2008-07-07 14:35:36 -0700
commit9178dcb68c092976f9bed29c13dbd70cb26de3a1 (patch)
tree5a2bc6847d259919332af1632b24f69bab4a634c /scripts
parent93a148a78b577ced2cfaebdbe1659e3ecc58c4aa (diff)
downloadvyatta-cfg-9178dcb68c092976f9bed29c13dbd70cb26de3a1.tar.gz
vyatta-cfg-9178dcb68c092976f9bed29c13dbd70cb26de3a1.zip
fix for bug 3323: skip deletions of nodes with default values when loading
a config file.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/VyattaConfigLoad.pm13
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/VyattaConfigLoad.pm b/scripts/VyattaConfigLoad.pm
index 6f8a451..1a7f26e 100755
--- a/scripts/VyattaConfigLoad.pm
+++ b/scripts/VyattaConfigLoad.pm
@@ -397,8 +397,19 @@ sub getConfigDiff {
# everything together anyway.
@delete_list = sort { ${$a}[1] <=> ${$b}[1] } @delete_list;
@set_list = sort { ${$b}[1] <=> ${$a}[1] } @set_list;
+
+ # need to filter out deletions of nodes with default values
+ my @new_delete_list = ();
+ foreach my $del (@delete_list) {
+ my @comps = map { s/^'(.*)'$/$1/; $_; } @{${$del}[0]};
+ my ($is_multi, $is_text, $default) = $active_cfg->parseTmpl(\@comps);
+ if (!defined($default)) {
+ push @new_delete_list, $del;
+ }
+ }
+
my %diff = (
- 'delete' => \@delete_list,
+ 'delete' => \@new_delete_list,
'set' => \@set_list,
);
return %diff;