Introduce the exit with a critical error if the check function of a hook fails.
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}."
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() {
WARNING)
colour="${CLR_YELLOW_R}"
;;
- ERROR)
+ CRITICAL|ERROR)
colour="${CLR_RED_B}"
;;
esac