diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2010-07-28 14:30:32 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2010-07-28 14:30:32 -0700 |
commit | 639c835bc2730a4fbffd915f5b2028a68375ee7a (patch) | |
tree | 203d61e1d5e8ef422d6aba3851d2f83a1f838b6b /scripts/vyatta-load-config.pl | |
parent | 0247864ef578ac05bbac8dc5175e674ce7b82714 (diff) | |
download | vyatta-cfg-639c835bc2730a4fbffd915f5b2028a68375ee7a.tar.gz vyatta-cfg-639c835bc2730a4fbffd915f5b2028a68375ee7a.zip |
add new cstore library
Diffstat (limited to 'scripts/vyatta-load-config.pl')
-rwxr-xr-x | scripts/vyatta-load-config.pl | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl index a101e31..20cf200 100755 --- a/scripts/vyatta-load-config.pl +++ b/scripts/vyatta-load-config.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Author: An-Cheng Huang <ancheng@vyatta.com. +# Author: Vyatta <eng@vyatta.com> # Date: 2007 # Description: Perl script for loading config file at run time. @@ -27,6 +27,7 @@ use POSIX; use IO::Prompt; use Getopt::Long; use Sys::Syslog qw(:standard :macros); +use Vyatta::Config; use Vyatta::ConfigLoad; $SIG{'INT'} = 'IGNORE'; @@ -188,7 +189,7 @@ if ( scalar( keys %cfg_hier ) == 0 ) { } } -my %cfg_diff = Vyatta::ConfigLoad::getConfigDiff( \%cfg_hier, 'true' ); +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'} }; @@ -224,25 +225,20 @@ 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 + my $cmd = "$sbindir/my_activate $_"; + system("$cmd 1>/dev/null"); + #ignore error on complaint re: nested nodes } +my $cobj = new Vyatta::Config; foreach (@deactivate_list) { - my @cp = split(" ",$_); - my $p = join("/",@cp[0..$#cp-1]); - my $leaf = "$ENV{VYATTA_TEMP_CONFIG_DIR}/$p/node.val"; - my $c = ""; - if (-e $leaf) { - $c = join(" ",@cp[0..$#cp-1]); - } - else { - $c = join(" ",@cp); - } - my $cmd = "$sbindir/vyatta-activate-config.pl deactivate $c"; - system("$cmd 1>/dev/null"); - #ignore error on complaint re: nested nodes + if ($cobj->isLeafValue($_)) { + # a leaf value. go up 1 level by removing the last comp. + s/\s+\S+$//; + } + my $cmd = "$sbindir/my_deactivate $_"; + system("$cmd 1>/dev/null"); + #ignore error on complaint re: nested nodes } foreach (@comment_list) { @@ -254,7 +250,7 @@ foreach (@comment_list) { my $rel_path = join '/', @cmd_array; my $path = "/opt/vyatta/config/active/" . $rel_path . "/.comment"; if (-e $path) { - my @cmd = ( "$sbindir/vyatta-comment-config.pl ", $cmd_ref ); + my @cmd = ( "$sbindir/my_comment ", $cmd_ref ); my $cmd_str = join ' ', @cmd; system("$cmd_str 1>/dev/null"); } @@ -266,7 +262,7 @@ foreach (@comment_list) { if (-e $leaf) { $path = "/opt/vyatta/config/active/" . $rel_path . "/.comment"; if (-e $path) { - my @cmd = ( "$sbindir/vyatta-comment-config.pl ", $cmd_ref ); + my @cmd = ( "$sbindir/my_comment ", $cmd_ref ); my $cmd_str = join ' ', @cmd; system("$cmd_str 1>/dev/null"); } @@ -274,7 +270,7 @@ foreach (@comment_list) { } } else { - my @cmd = ( "$sbindir/vyatta-comment-config.pl ", $cmd_ref ); + my @cmd = ( "$sbindir/my_comment ", $cmd_ref ); my $cmd_str = join ' ', @cmd; system("$cmd_str 1>/dev/null"); } |