From: Stefan Schantl Date: Thu, 9 May 2013 04:30:49 +0000 (+0000) Subject: Exit if the check functionality of a hook fails. X-Git-Tag: 007~138^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab6992519c3079ebd8ba986ceecfe217eb9e426e;p=network.git Exit if the check functionality of a hook fails. Introduce the exit with a critical error if the check function of a hook fails. --- diff --git a/functions.config b/functions.config index 11e92466..9f4a075a 100644 --- a/functions.config +++ b/functions.config @@ -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() { diff --git a/functions.logging b/functions.logging index d3043ef8..57b43261 100644 --- a/functions.logging +++ b/functions.logging @@ -64,7 +64,7 @@ function log() { WARNING) colour="${CLR_YELLOW_R}" ;; - ERROR) + CRITICAL|ERROR) colour="${CLR_RED_B}" ;; esac