summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/Vyatta/Config.pm23
-rwxr-xr-xlib/Vyatta/ConfigLoad.pm4
-rwxr-xr-xscripts/vyatta-load-config.pl11
3 files changed, 37 insertions, 1 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;
diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl
index 296dc0d..9284cba 100755
--- a/scripts/vyatta-load-config.pl
+++ b/scripts/vyatta-load-config.pl
@@ -191,6 +191,7 @@ if ( scalar( keys %cfg_hier ) == 0 ) {
my %cfg_diff = Vyatta::ConfigLoad::getConfigDiff( \%cfg_hier );
my @set_list = @{ $cfg_diff{'set'} };
my @deactivate_list = @{ $cfg_diff{'deactivate'} };
+my @activate_list = @{ $cfg_diff{'activate'} };
my @comment_list = @{ $cfg_diff{'comment'} };
if ($merge_mode eq 'false') {
@@ -219,8 +220,16 @@ foreach (@set_list) {
}
}
+
+
+
+foreach (@activate_list) {
+ my $cmd = "$sbindir/vyatta-activate-config.pl activate $_";
+ system("$cmd 1>/dev/null");
+ #ignore error on complaint re: nested nodes
+}
+
foreach (@deactivate_list) {
- #need to remove .disable nodes recursively in tree through activate command
my $cmd = "$sbindir/vyatta-activate-config.pl deactivate $_";
system("$cmd 1>/dev/null");
#ignore error on complaint re: nested nodes