use bool to only verify if active/stopped 1st time

This commit is contained in:
Heavybullets8 2022-08-11 21:20:04 -06:00
parent 1473a969e2
commit 99dc8fcef8

View File

@ -176,7 +176,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then
status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}')
if [[ $count -lt 1 ]]; then
old_status=$status
elif [[ $status != "DEPLOYING" ]]; then
elif [[ $verify == "true" ]]; then
before_loop=$(head -n 1 temp.txt)
new_status=$old_status
current_loop=0
@ -194,21 +194,21 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then
(( count++ ))
if [[ "$status" == "ACTIVE" ]]; then
if [[ "$startstatus" == "STOPPED" ]]; then
[[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && continue #if reports active on FIRST time through loop, double check
[[ "$count" -le 1 && -z "$verbose" ]] && continue #if reports active on FIRST time through loop, double check
[[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && verify="true" && continue #if reports active on FIRST time through loop, double check
[[ "$count" -le 1 && -z "$verbose" ]] && verify="true" && continue #if reports active on FIRST time through loop, double check
[[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..")
midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || { echo_array+=("Error: Failed to stop $app_name") ; break ; }
echo_array+=("Stopped")
break
else
[[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && continue #if reports active on FIRST time through loop, double check
[[ "$count" -le 1 && -z "$verbose" ]] && continue #if reports active on FIRST time through loop, double check
[[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && verify="true" && continue #if reports active on FIRST time through loop, double check
[[ "$count" -le 1 && -z "$verbose" ]] && verify="true" && continue #if reports active on FIRST time through loop, double check
echo_array+=("Active")
break #if reports active any time after the first loop, assume actually active.
fi
elif [[ "$status" == "STOPPED" ]]; then
[[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && continue #if reports stopped on FIRST time through loop, double check
[[ "$count" -le 1 && -z "$verbose" ]] && continue #if reports stopped on FIRST time through loop, double check
[[ "$count" -le 1 && "$verbose" == "true" ]] && verify="true" && echo_array+=("Verifying Stopped..") && continue #if reports stopped on FIRST time through loop, double check
[[ "$count" -le 1 && -z "$verbose" ]] && verify="true" && continue #if reports stopped on FIRST time through loop, double check
echo_array+=("Stopped")
break #if reports stopped any time after the first loop, assume its extermal services.
elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then
@ -236,7 +236,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then
fi
else
[[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE")
sleep 10
sleep 5
continue
fi
done