From 6122ac482aa5ff4aa543379fda193dd59cd91db3 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Fri, 4 Jun 2010 11:42:26 -0700 Subject: 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. --- scripts/vyatta-activate-config.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 @@ -114,6 +114,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 ####################################################### -- cgit v1.2.3