[fix] Only check log_size_limit on .2X -> .30

* Since we're showing a message in the middle of soup, wait for keypress if it's shown
This commit is contained in:
William Wernert
2021-02-24 12:33:36 -05:00
parent 4507a89d95
commit ac6f1df86f

View File

@@ -121,10 +121,13 @@ check_sudoers() {
}
check_log_size_limit() {
local wait_for_enter=false
local num_minion_pillars
num_minion_pillars=$(find /opt/so/saltstack/local/pillar/minions/ -type f | wc -l)
if [[ $num_minion_pillars -gt 1 ]]; then
wait_for_enter=true
echo "[INFO] The value of log_size_limit in the minion pillars may be incorrect."
echo " -> We recommend checking and adjusting the values as necessary."
else
@@ -166,9 +169,16 @@ check_log_size_limit() {
new_limit=$( echo "$disk_size_gb" "$percent" | awk '{printf("%.0f", $1 * ($2/100))}')
if [[ $current_limit != "$new_limit" ]]; then
wait_for_enter=true
echo "[WARNING] The value of log_size_limit (${current_limit}) does not match the recommended value of ${new_limit}."
echo " -> We recommend checking and adjusting the value as necessary."
fi
if [[ $wait_for_enter == true ]]; then
echo ""
read -n 1 -s -r -p "Press any key to continue..."
echo "" # Since read doesn't print a newline, print one for it
fi
fi
}
@@ -392,6 +402,7 @@ up_2.3.2X_to_2.3.30() {
for pillar in "${minion_pillars[@]}"; do
sed -i -r "s/ (\{\{.*}})$/ '\1'/g" "$pillar"
done
check_log_size_limit
}
space_check() {
@@ -714,7 +725,7 @@ fi
check_sudoers
check_log_size_limit
}