Skip to content

Commit

Permalink
runs all required scripts in greenboot check
Browse files Browse the repository at this point in the history
The unit tests have include the following test:
"Test greenboot runs all required scripts even if one fails"

Yet, the scripts under /etc/greenboot/check/require.d will not run if
any script under /usr/lib/greenboot/check/require.d fails.

Change that behavior to match the behavior described in the unit test
and run all scripts, vendor or system specific, that are available and
return an error code if any failed.

Signed-off-by: Eric Chanudet <[email protected]>
  • Loading branch information
eric-ch authored and nullr0ute committed Jun 5, 2023
1 parent 16ab67b commit d3f569f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions usr/libexec/greenboot/greenboot
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ script_runner () {
fi
done

if [[ $required_hc_failed == true ]]; then
exit 1
fi
[[ $required_hc_failed == false ]]
}

case "$1" in
"check")
rc=0
for health_check_path in "${SCRIPTS_CHECK_PATHS[@]}"; do
script_runner "$health_check_path/required.d" "strict" "Running Required Health Check Scripts..." || exit 1
script_runner "$health_check_path/required.d" "strict" "Running Required Health Check Scripts..." || rc=1
script_runner "$health_check_path/wanted.d" "relaxed" "Running Wanted Health Check Scripts..."
done
exit $rc
;;
"green")
echo "<5>Boot Status is GREEN - Health Check SUCCESS"
Expand Down

0 comments on commit d3f569f

Please sign in to comment.