summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Larson <slioch@slioch.vyatta.com>2010-06-04 11:42:26 -0700
committerMichael Larson <slioch@slioch.vyatta.com>2010-06-04 11:42:26 -0700
commit6122ac482aa5ff4aa543379fda193dd59cd91db3 (patch)
tree2010da97d1c7f329fc6981dca8a4efe729a41f32 /scripts
parent56235f054022d2f47323937db79af3297bd82589 (diff)
downloadvyatta-cfg-6122ac482aa5ff4aa543379fda193dd59cd91db3.tar.gz
vyatta-cfg-6122ac482aa5ff4aa543379fda193dd59cd91db3.zip
prevent deactivate from being applied to a created node within a single commit.
this simplfies logic on back end that would need to handle the negation (deactivate) and the addition (create) of a node.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vyatta-activate-config.pl16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/vyatta-activate-config.pl b/scripts/vyatta-activate-config.pl
index f1269e1..acbdcf5 100644
--- a/scripts/vyatta-activate-config.pl
+++ b/scripts/vyatta-activate-config.pl
@@ -115,6 +115,22 @@ if ($action eq 'deactivate') {
}
#######################################################
+#prevent deactivate or activate to be applied with
+#uncommitted changes
+#######################################################
+if (-e "$ENV{VYATTA_CHANGES_ONLY_DIR}/$path") {
+ opendir DIR, "$ENV{VYATTA_CHANGES_ONLY_DIR}/$path";
+ my @files = readdir DIR;
+ foreach my $d (@files) {
+ if ($d ne '.' && $d ne '..') {
+ print("Cannot $action modified elements, please commit your changes and then deactivate.\n");
+ closedir DIR;
+ exit 1;
+ }
+ }
+ closedir DIR;
+}
+#######################################################
#now apply the magic
#######################################################
if ($action eq 'activate') {