update update function

This commit is contained in:
Heavybullets8 2022-08-11 20:41:31 -06:00
parent 5d3470c2dd
commit e2942dd626

View File

@ -137,27 +137,31 @@ count=0
while true while true
do do
update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')
if [[ $count -gt 2 ]]; then # if [[ $count -gt 2 ]]; then
return 1 # return 1
elif [[ $update_avail == "true" ]]; then if [[ $update_avail == "true" ]]; then
if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then
# sleep 6 # sleep 6
# ((count++)) # ((count++))
# continue # continue
before_loop=$(head -n 1 temp.txt) before_loop=$(head -n 1 temp.txt)
current_loop=0 current_loop=0
until [[ "$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')" != "$update_avail" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. until [[ "$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by.
do do
sleep 1 if [[ $current_loop -gt 3 ]]; then
if ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then return 1 #App failed to update, return error code to update_apps func
elif ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then # The file has been updated, but nothing changed specifically for the app.
before_loop=$(head -n 1 temp.txt) before_loop=$(head -n 1 temp.txt)
((current_loop++)) ((current_loop++))
fi fi
sleep 1
done done
fi fi
break break
elif [[ $update_avail == "false" ]]; then elif [[ $update_avail == "false" ]]; then
break break
else
sleep 3
fi fi
done done
} }