summaryrefslogtreecommitdiff
path: root/scripts/vyatta-config-loader.pl
diff options
context:
space:
mode:
authorMichael Larson <slioch@slioch.vyatta.com>2010-05-21 10:19:01 -0700
committerMichael Larson <slioch@slioch.vyatta.com>2010-05-21 10:19:01 -0700
commit755f0d7a791c7d80ebd4017aa1e853ee0614cd29 (patch)
treecb881d491a2e0adcba19edb0b08123215b6d27f3 /scripts/vyatta-config-loader.pl
parente11c320caa96d58396eddd91052a0c58a67bb69e (diff)
downloadvyatta-cfg-755f0d7a791c7d80ebd4017aa1e853ee0614cd29.tar.gz
vyatta-cfg-755f0d7a791c7d80ebd4017aa1e853ee0614cd29.zip
fix for disable nodes loading (bug 5610). Additional checks added on configuration of disable nodes. requires vyatta-config-migrate package as well.
Additional fix required for loading configuration with deactivated nodes that are activated through the loading process.
Diffstat (limited to 'scripts/vyatta-config-loader.pl')
-rwxr-xr-xscripts/vyatta-config-loader.pl18
1 files changed, 10 insertions, 8 deletions
diff --git a/scripts/vyatta-config-loader.pl b/scripts/vyatta-config-loader.pl
index b8e594e..0aae55b 100755
--- a/scripts/vyatta-config-loader.pl
+++ b/scripts/vyatta-config-loader.pl
@@ -46,7 +46,9 @@ sub restore_fds {
}
# get a list of all config statement in the startup config file
-my @all_nodes = Vyatta::ConfigLoad::getStartupConfigStatements($ARGV[0],'true');
+my %cfg_hier = Vyatta::ConfigLoad::getStartupConfigStatements($ARGV[0],'true');
+my @all_nodes = @{ $cfg_hier{'set'} };
+my @deactivate_nodes = @{ $cfg_hier{'deactivate'} };
if (scalar(@all_nodes) == 0) {
# no config statements
restore_fds();
@@ -98,13 +100,6 @@ foreach (@all_nodes) {
next;
}
- if (@pr[0] eq '!') {
- @pr = @pr[1..$#pr];
- my $deactivate_cmd = "$CWRAPPER deactivate " . (join ' ', @pr) . " 1>/dev/null";
- system("$deactivate_cmd");
- #ignore these errors due to nesting warnings.
- }
-
my $cmd = "$CWRAPPER set " . (join ' ', @pr);
# this debug file should be deleted before release
system("echo [$cmd] >> /tmp/foo");
@@ -116,6 +111,13 @@ foreach (@all_nodes) {
# continue after set failure (or should we abort?)
}
}
+
+# Now deactivate these nodes
+for (@deactivate_nodes) {
+ my $cmd = "$CWRAPPER deactivate " . $_ . " 1>/dev/null";
+ system("$cmd");
+}
+
$ret = system("$commit_cmd");
if ($ret >> 8) {
print OLDOUT "Commit failed at boot\n";