From ca234139fa6b8ce95c144e422973fd5346e02c14 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 5 Feb 2009 11:17:02 -0800 Subject: Fix reload If setting up transaction fails, then fail the reload Use correct tmp file, and remove if successful. --- scripts/vyatta-protocol | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-protocol b/scripts/vyatta-protocol index e8fff484..4ff0c941 100755 --- a/scripts/vyatta-protocol +++ b/scripts/vyatta-protocol @@ -49,20 +49,24 @@ case "$1" in reload) # Start new transaction - /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper begin + /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper begin || exit 1 # In case of error undo trap "/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper end" EXIT HUP INT QUIT TERM # Save current configuration tmp=/tmp/${protocol}-restart.$$ - /opt/vyatta/sbin/vyatta-save-config.pl $tmp + /opt/vyatta/sbin/vyatta-save-config.pl $tmp || exit 1 # Erase active configuration for that protocol rm -fr /opt/vyatta/config/active/protocols/$protocol # Reload causing configuration to activate - implies commit - /opt/vyatta/sbin/vyatta-load-config.pl $TMP + # remove tmp file if successful + /opt/vyatta/sbin/vyatta-load-config.pl $tmp || exit 1 + + rm $tmp + ;; *) usage;; -- cgit v1.2.3