From e91fd6d2d20031df2e1ea6f9d41179cc3f837dbc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 16:42:05 -0600 Subject: [PATCH] thwart wrong reporting --- heavy_script.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 9f3d36ee..b339bef2 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -256,21 +256,23 @@ if [[ $rollback == "true" ]]; then else if [[ "$startstatus" == "STOPPED" ]]; then status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') - while [[ "$status" != "STOPPED" ]] + while [[ "0" != "1" ]] do (( count++ )) [[ "$count" -ge 2 ]] && status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') #Skip first status check, due to the one directly above it. if [[ "$status" == "STOPPED" ]]; then - echo "Stopped" + [[ "$count" -le 1 ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -ge 2 ]] && echo "Stopped" && break #assume actually stopped anytime AFTER the first loop break elif [[ "$status" == "ACTIVE" ]]; then + [[ "$count" -le 1 ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" break elif [[ "$SECONDS" -ge "$timeout" ]]; then echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" break - elif [[ "$status" != "STOPPED" ]]; then + else [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" sleep 10 continue