Print the remediation measure only if the check is not passed

This commit is contained in:
Razvan Stoica 2021-03-11 09:32:29 +02:00
parent b3a36e8d94
commit c623d3afdd
2 changed files with 10 additions and 1 deletions

View file

@ -103,7 +103,7 @@ resulttestjson() {
printf "\"result\": \"%s\", \"details\": \"%s: %s\", \"items\": %s" "$1" "$2" "$truncItems" "$itemsJson" | tee -a "$logger.json" 2>/dev/null 1>&2
fi
# Log remediation measure
if [ -n "$remediation" ]; then
if [ -n "$remediation" ] && [ "$1" != "PASS" ]; then
printf ", \"remediation\": \"%s\"" "$remediation" | tee -a "$logger.json" 2>/dev/null 1>&2
if [ -n "$remediationImpact" ]; then
printf ", \"remediation-impact\": \"%s\"" "$remediationImpact" | tee -a "$logger.json" 2>/dev/null 1>&2

View file

@ -180,6 +180,7 @@ check_1_2_4() {
else
info "$check"
info " * Directory not found"
saveRemediation --id "${id}" --rem "${remediation}" --imp "${remediationImpact}"
resulttestjson "INFO" "Directory not found"
currentScore=$((currentScore + 0))
fi
@ -221,6 +222,7 @@ check_1_2_5() {
else
info "$check"
info " * Directory not found"
saveRemediation --id "${id}" --rem "${remediation}" --imp "${remediationImpact}"
resulttestjson "INFO" "Directory not found"
currentScore=$((currentScore + 0))
fi
@ -262,6 +264,7 @@ check_1_2_6() {
else
info "$check"
info " * File not found"
saveRemediation --id "${id}" --rem "${remediation}" --imp "${remediationImpact}"
resulttestjson "INFO" "File not found"
currentScore=$((currentScore + 0))
fi
@ -303,6 +306,7 @@ check_1_2_7() {
else
info "$check"
info " * File not found"
saveRemediation --id "${id}" --rem "${remediation}" --imp "${remediationImpact}"
resulttestjson "INFO" "File not found"
currentScore=$((currentScore + 0))
fi
@ -344,6 +348,7 @@ check_1_2_8() {
else
info "$check"
info " * File not found"
saveRemediation --id "${id}" --rem "${remediation}" --imp "${remediationImpact}"
resulttestjson "INFO" "File not found"
currentScore=$((currentScore + 0))
fi
@ -385,6 +390,7 @@ check_1_2_9() {
else
info "$check"
info " * File not found"
saveRemediation --id "${id}" --rem "${remediation}" --imp "${remediationImpact}"
resulttestjson "INFO" "File not found"
currentScore=$((currentScore + 0))
fi
@ -426,6 +432,7 @@ check_1_2_10() {
else
info "$check"
info " * File not found"
saveRemediation --id "${id}" --rem "${remediation}" --imp "${remediationImpact}"
resulttestjson "INFO" "File not found"
currentScore=$((currentScore + 0))
fi
@ -467,6 +474,7 @@ check_1_2_11() {
else
info "$check"
info " * File not found"
saveRemediation --id "${id}" --rem "${remediation}" --imp "${remediationImpact}"
resulttestjson "INFO" "File not found"
currentScore=$((currentScore + 0))
fi
@ -508,6 +516,7 @@ check_1_2_12() {
else
info "$check"
info " * File not found"
saveRemediation --id "${id}" --rem "${remediation}" --imp "${remediationImpact}"
resulttestjson "INFO" "File not found"
currentScore=$((currentScore + 0))
fi