From b99c7ce76ee769635baeb6fb815430b1cad2c706 Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Mon, 6 Nov 2023 11:22:35 -0500 Subject: [PATCH] improve verbosity of setup logs --- setup/so-setup | 1 + setup/so-verify | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/setup/so-setup b/setup/so-setup index 691d52a2c..a4e67535b 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -774,6 +774,7 @@ if ! [[ -f $install_opt_file ]]; then title "Setting up Elastic Fleet" logCmd "salt-call state.apply elasticfleet.config" if ! logCmd so-elastic-fleet-setup; then + error "Failed to run so-elastic-fleet-setup" fail_setup fi if [[ ! $is_import ]]; then diff --git a/setup/so-verify b/setup/so-verify index e4d90b937..3f00cc420 100755 --- a/setup/so-verify +++ b/setup/so-verify @@ -61,8 +61,11 @@ log_has_errors() { grep -vE "Running scope as unit" &> "$error_log" if [[ $? -eq 0 ]]; then + # This function succeeds (returns 0) if errors are detected return 0 fi + + # No errors found, return 1 (function failed to find errors) return 1 } @@ -121,7 +124,10 @@ main() { echo "WARNING: Failed setup a while ago" exit_code=1 elif log_has_errors; then - echo "WARNING: Errors detected during setup" + echo "WARNING: Errors detected during setup." + echo "--------- ERRORS ---------" + cat $error_log + echo "--------------------------" exit_code=1 touch /root/failure elif using_iso && cron_error_in_mail_spool; then