mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
change exitCode to exitcode. set exitcode to 1 if failed output found
This commit is contained in:
@@ -309,21 +309,21 @@ retry() {
|
|||||||
echo "Results: $output ($exitcode)"
|
echo "Results: $output ($exitcode)"
|
||||||
if [ -n "$expectedOutput" ]; then
|
if [ -n "$expectedOutput" ]; then
|
||||||
if [[ "$output" =~ "$expectedOutput" ]]; then
|
if [[ "$output" =~ "$expectedOutput" ]]; then
|
||||||
return $exitCode
|
return $exitcode
|
||||||
else
|
else
|
||||||
echo "Expected '$expectedOutput' but got '$output'"
|
echo "Expected '$expectedOutput' but got '$output'"
|
||||||
fi
|
fi
|
||||||
elif [ -n "$failedOutput" ]; then
|
elif [ -n "$failedOutput" ]; then
|
||||||
if [[ "$output" =~ "$failedOutput" ]]; then
|
if [[ "$output" =~ "$failedOutput" ]]; then
|
||||||
echo "Found failed output '$failedOutput' in '$output'"
|
echo "Found failed output '$failedOutput' in '$output'. Setting exitcode to 1."
|
||||||
if [[ $exitcode -eq 0 ]]; then
|
if [[ $exitcode -eq 0 ]]; then
|
||||||
exitcode="${exitcode} (This is 0, but we found '$failedOutput' in the output.)"
|
exitcode=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
return $exitCode
|
return $exitcode
|
||||||
fi
|
fi
|
||||||
elif [[ $exitcode -eq 0 ]]; then
|
elif [[ $exitcode -eq 0 ]]; then
|
||||||
return $exitCode
|
return $exitcode
|
||||||
fi
|
fi
|
||||||
echo "Command failed with exit code $exitcode; will retry in $sleepDelay seconds ($attempt / $maxAttempts)..."
|
echo "Command failed with exit code $exitcode; will retry in $sleepDelay seconds ($attempt / $maxAttempts)..."
|
||||||
sleep $sleepDelay
|
sleep $sleepDelay
|
||||||
|
|||||||
Reference in New Issue
Block a user