From d2746153769f797a3d4f10b6350fd3c91c6d0423 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Thu, 30 Dec 2021 10:45:30 -0500 Subject: [PATCH] change exitCode to exitcode. set exitcode to 1 if failed output found --- salt/common/tools/sbin/so-common | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index 3409b9744..fcd9c08f2 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -309,21 +309,21 @@ retry() { echo "Results: $output ($exitcode)" if [ -n "$expectedOutput" ]; then if [[ "$output" =~ "$expectedOutput" ]]; then - return $exitCode + return $exitcode else echo "Expected '$expectedOutput' but got '$output'" fi elif [ -n "$failedOutput" ]; then if [[ "$output" =~ "$failedOutput" ]]; then - echo "Found failed output '$failedOutput' in '$output'" - if [[ $exitcode -eq 0 ]]; then - exitcode="${exitcode} (This is 0, but we found '$failedOutput' in the output.)" - fi + echo "Found failed output '$failedOutput' in '$output'. Setting exitcode to 1." + if [[ $exitcode -eq 0 ]]; then + exitcode=1 + fi else - return $exitCode + return $exitcode fi elif [[ $exitcode -eq 0 ]]; then - return $exitCode + return $exitcode fi echo "Command failed with exit code $exitcode; will retry in $sleepDelay seconds ($attempt / $maxAttempts)..." sleep $sleepDelay