From 6b7c68317bae95b5627e02423cccbb659f7e5ff2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 14 Sep 2022 19:06:04 -0600 Subject: [PATCH] include truetool backups in overflow --- functions/backup.sh | 6 +++--- functions/update_apps.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 0ca69069..c1b2f4a0 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -7,11 +7,11 @@ echo_backup+=("Number of backups was set to $number_of_backups") date=$(date '+%Y_%m_%d_%H_%M_%S') [[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' &> /dev/null && echo_backup+=(HeavyScript_"$date") [[ -z "$verbose" ]] && echo_backup+=("\nNew Backup Name:") && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 &> /dev/null && echo_backup+=(HeavyScript_"$date") -mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") +mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep -E "HeavyScript_|TrueTool_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") if [[ ${#list_backups[@]} -gt "$number_of_backups" ]]; then echo_backup+=("\nDeleted the oldest backup(s) for exceeding limit:") overflow=$(( ${#list_backups[@]} - "$number_of_backups" )) - mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") + mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep -E "HeavyScript_|TrueTool_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") for i in "${list_overflow[@]}" do cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo_backup+=("Failed to delete $i") @@ -115,7 +115,7 @@ restore(){ while true do clear -x && echo "pulling restore points.." - list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) + list_backups=$(cli -c 'app kubernetes list_backups' | grep -E "HeavyScript_|TrueTool_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) if [[ -z "$list_backups" ]]; then echo "No HeavyScript restore points available" exit diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 7bb79888..9f54bb33 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -21,8 +21,8 @@ do new_chart_ver=$(echo "$app" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions - old_full_ver=$(echo "${array[$index]}" | awk -F ',' '{print $4}') #Upgraded From - new_full_ver=$(echo "${array[$index]}" | awk -F ',' '{print $5}') #Upraded To + old_full_ver=$(echo "$app" | awk -F ',' '{print $4}') #Upgraded From + new_full_ver=$(echo "$app" | awk -F ',' '{print $5}') #Upraded To #Skip application if its on ignore list if printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" ; then