Merge pull request #29 from Heavybullets8/small-fixes
- include truetool delete overflow backups - small array fixe
This commit is contained in:
commit
71650cec24
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user