summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Larson <slioch@slioch.vyatta.com>2010-05-25 09:52:45 -0700
committerMichael Larson <slioch@slioch.vyatta.com>2010-05-25 09:52:45 -0700
commit36ea15e7d9119a19f3541ca16a2b4f13efc8dac7 (patch)
tree87dba45a3f3669243b79e2e64c2f5c051ac703cd /lib
parent308ac78af23dbac8d70a172ca5c6cc70c8cd0e31 (diff)
downloadvyatta-cfg-36ea15e7d9119a19f3541ca16a2b4f13efc8dac7.tar.gz
vyatta-cfg-36ea15e7d9119a19f3541ca16a2b4f13efc8dac7.zip
final fix for 5610. fixes loading where node in active config is deactivated and is active in loaded configuration.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Vyatta/Config.pm23
-rwxr-xr-xlib/Vyatta/ConfigLoad.pm4
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm
index e4d74bb..91f8101 100755
--- a/lib/Vyatta/Config.pm
+++ b/lib/Vyatta/Config.pm
@@ -22,6 +22,7 @@ package Vyatta::Config;
use strict;
use Vyatta::ConfigDOMTree;
+use File::Find;
my %fields = (
_changes_only_dir_base => $ENV{VYATTA_CHANGES_ONLY_DIR},
@@ -546,6 +547,28 @@ sub listDeleted {
return @deleted;
}
+## getAllDeactivated()
+# returns array of all deactivated nodes.
+#
+my @all_deactivated_nodes;
+sub getAllDeactivated {
+ my ($self, $path) = @_;
+ my $start_dir = $self->{_active_dir_base};
+ find ( \&wanted, $start_dir );
+ return @all_deactivated_nodes;
+}
+sub wanted {
+ if ( $_ eq '.disable' ) {
+ my $f = $File::Find::name;
+ #now strip off leading path and trailing file
+ $f = substr($f, length($ENV{VYATTA_ACTIVE_CONFIGURATION_DIR}));
+ $f = substr($f, 0, length($f)-length("/.disable"));
+ $f =~ s/\// /g;
+ push @all_deactivated_nodes, $f;
+ }
+}
+
+
## isDeactivated("node")
# returns back whether this node is in an active (false) or
# deactivated (true) state.
diff --git a/lib/Vyatta/ConfigLoad.pm b/lib/Vyatta/ConfigLoad.pm
index 183e598..033aec0 100755
--- a/lib/Vyatta/ConfigLoad.pm
+++ b/lib/Vyatta/ConfigLoad.pm
@@ -405,10 +405,14 @@ sub getConfigDiff {
}
}
+ #let's get active disable nodes
+ my @enable_list = $active_cfg->getAllDeactivated("");;
+
my %diff = (
'delete' => \@new_delete_list,
'set' => \@set_list,
'deactivate' => \@disable_list,
+ 'activate' => \@enable_list,
'comment' => \@comment_list,
);
return %diff;