]> git.ipfire.org Git - people/stevee/network.git/commitdiff
Exit if the check functionality of a hook fails.
authorStefan Schantl <stefan.schantl@ipfire.org>
Thu, 9 May 2013 04:30:49 +0000 (04:30 +0000)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 9 May 2013 04:30:49 +0000 (04:30 +0000)
Introduce the exit with a critical error if the check function of a hook fails.

functions.config
functions.logging

index 11e924669331c792b701c6a9ed643ea61da155c2..9f4a075a1527177ae1d07f94e2e9a56f5fd40fda 100644 (file)
@@ -116,7 +116,10 @@ function config_write() {
        shift
 
        # Check if all values to be written are sane
-       config_check
+       if ! config_check; then
+               log CRITICAL "Configuration check failed. No config has been written."
+               return ${EXIT_ERROR}
+       fi
 
        log DEBUG "Writing configuration file ${config_file}."
 
@@ -140,7 +143,7 @@ function config_print() {
 function config_check() {
        # If there is a function defined that is called __check
        # we call that function
-       [ -n "$(type -t _check)" ] && _check
+       [ -n "$(type -t _check)" ] && _check || return $?
 }
 
 function config_header() {
index d3043ef8afd3a27b53a1a995d8a84efdd1c84a3a..57b432617220dfec9987b2602eaf512cdf1dbede 100644 (file)
@@ -64,7 +64,7 @@ function log() {
                WARNING)
                        colour="${CLR_YELLOW_R}"
                        ;;
-               ERROR)
+               CRITICAL|ERROR)
                        colour="${CLR_RED_B}"
                        ;;
        esac