summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-02-05 11:17:02 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-02-05 11:17:02 -0800
commitca234139fa6b8ce95c144e422973fd5346e02c14 (patch)
treeba009c6231bb81ddcd71669263c2ed418d458a27 /scripts
parent7047feb74cec411ce51d00a87005ee284cb51fe8 (diff)
downloadvyatta-cfg-quagga-ca234139fa6b8ce95c144e422973fd5346e02c14.tar.gz
vyatta-cfg-quagga-ca234139fa6b8ce95c144e422973fd5346e02c14.zip
Fix reload
If setting up transaction fails, then fail the reload Use correct tmp file, and remove if successful.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-protocol10
1 files changed, 7 insertions, 3 deletions
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;;