mirror of
https://github.com/ovh/debian-cis.git
synced 2025-08-06 23:25:49 +02:00
fix: Catch unexpected failures (#140)
Signed-off-by: Tarik Megzari <tarik.megzari@corp.ovh.com> Co-authored-by: Tarik Megzari <tarik.megzari@corp.ovh.com>
This commit is contained in:
@@ -11,6 +11,7 @@ status=""
|
||||
forcedstatus=""
|
||||
SUDO_CMD=""
|
||||
SAVED_LOGLEVEL=""
|
||||
ACTIONS_DONE=0
|
||||
|
||||
if [ -n "${LOGLEVEL:-}" ]; then
|
||||
SAVED_LOGLEVEL=$LOGLEVEL
|
||||
@@ -111,6 +112,9 @@ if [ -z "$status" ]; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# We want to trap unexpected failures in check scripts
|
||||
trap exception EXIT
|
||||
|
||||
case $status in
|
||||
enabled | true)
|
||||
info "Checking Configuration"
|
||||
@@ -128,6 +132,7 @@ audit)
|
||||
;;
|
||||
disabled | false)
|
||||
info "$SCRIPT_NAME is disabled, ignoring"
|
||||
ACTIONS_DONE=1
|
||||
exit 2 # Means unknown status
|
||||
;;
|
||||
*)
|
||||
@@ -135,6 +140,8 @@ disabled | false)
|
||||
;;
|
||||
esac
|
||||
|
||||
ACTIONS_DONE=1
|
||||
|
||||
if [ "$CRITICAL_ERRORS_NUMBER" -eq 0 ]; then
|
||||
if [ "$BATCH_MODE" -eq 1 ]; then
|
||||
BATCH_OUTPUT="OK $SCRIPT_NAME $BATCH_OUTPUT"
|
||||
|
Reference in New Issue
Block a user