From ab6992519c3079ebd8ba986ceecfe217eb9e426e Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Thu, 9 May 2013 04:30:49 +0000 Subject: [PATCH] Exit if the check functionality of a hook fails. Introduce the exit with a critical error if the check function of a hook fails. --- functions.config | 7 +++++-- functions.logging | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) 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 -- 2.47.3