From 9afb59571b7de247fbd7482f30d90d7a37a32ef5 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Thu, 27 May 2010 11:37:20 -0700 Subject: fix for loading config for deactivated nodes. allows nested deactivates within a single set of deactivated commands. only preserves the parent deactivated node in this case. --- scripts/vyatta-activate-config.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/vyatta-activate-config.pl b/scripts/vyatta-activate-config.pl index 3eca90f..5d7b7ab 100644 --- a/scripts/vyatta-activate-config.pl +++ b/scripts/vyatta-activate-config.pl @@ -31,6 +31,14 @@ sub wanted { exit 1; } +sub wanted_local { + if ( $_ eq '.disable' ) { + #we'll supercede this .disable by the parent and remove this. + my $f = $File::Find::name; + `rm -f $f`; + } +} + sub check_parents { my @p = @_; my $l_dir = "$ENV{VYATTA_TEMP_CONFIG_DIR}/"; @@ -96,8 +104,8 @@ if ($action eq 'deactivate') { if (-e $active_dir) { #checks active children find( \&wanted, $active_dir ); } - if (-e $local_dir) { #checks locally commit children - find( \&wanted, $local_dir ); + if (-e $local_dir) { #checks locally commit children, will remove disabled children + find( \&wanted_local, $local_dir ); } #final check that walks up tree and checks if (check_parents(@path)) { #checks active and locally committed parents -- cgit v1.2.3