From 20499ead136fc0ac7bd4c46bb2086c709923b54e Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Wed, 14 Feb 2024 11:07:57 -0800 Subject: [PATCH] Add basic error handling to configure.sh Add newline to end of test.sh --- wizard/config/configure.sh | 63 ++++++++++++++++++++++++++++++++------ wizard/config/test.sh | 2 +- 2 files changed, 54 insertions(+), 11 deletions(-) diff --git a/wizard/config/configure.sh b/wizard/config/configure.sh index c98e92f..d6b2fb5 100644 --- a/wizard/config/configure.sh +++ b/wizard/config/configure.sh @@ -8,15 +8,58 @@ source /opt/vyatta/etc/functions/script-template configure -source test.sh -#source firewall.sh -#source interfaces.sh -#source nat.sh -#source qos.sh -#source service.sh -#source system.sh +echo "===== Configure firewall... =====" +{ + source firewall.sh +} || { + echo "===== Failed to configure firewall =====" +} + +echo "===== Configure interfaces... =====" +{ + source interfaces.sh +} || { + echo "===== Failed to configure interfaces =====" +} + +echo "===== Configure NAT... =====" +{ + source nat.sh +} || { + echo "===== Failed to configure NAT =====" +} + +echo "===== Configure QoS... =====" +{ + source qos.sh +} || { + echo "===== Failed to configure QoS =====" +} + + +echo "===== Configure services... =====" +{ + source service.sh +} || { + echo "===== Failed to configure services =====" +} + + +echo "===== Configure system... =====" +{ + source system.sh +} || { + echo "===== Failed to configure system =====" +} + compare -commit -save -exit \ No newline at end of file + +{ # try commit, save + commit && save +} || { # catch, exit discard and print a very basic error message + exit discard + echo "Failed to commit and save the configuration." +} + +exit diff --git a/wizard/config/test.sh b/wizard/config/test.sh index 36ed07f..abaf2bb 100644 --- a/wizard/config/test.sh +++ b/wizard/config/test.sh @@ -1,3 +1,3 @@ #!/bin/vbash -set system task-scheduler task update-nat-reflection interval '30' \ No newline at end of file +set system task-scheduler task update-nat-reflection interval '30'