[fix] Kill + start salt-minion if it isn't responding

This commit is contained in:
William Wernert
2020-12-03 14:42:13 -05:00
parent ddcf5dec5b
commit 2e516629f9

View File

@@ -1382,10 +1382,12 @@ reserve_group_ids() {
reinstall_init() { reinstall_init() {
info "Putting system in state to run setup again" info "Putting system in state to run setup again"
local salt_services=( if [[ $install_type =~ ^(MANAGER|EVAL|HELIXSENSOR|MANAGERSEARCH|STANDALONE|FLEET|IMPORT)$ ]]; then
"salt-master" local salt_services=( "salt-master" "salt-minion" )
"salt-minion" else
) local salt_services=( "salt-minion" )
fi
local service_retry_count=20 local service_retry_count=20
{ {
@@ -1412,6 +1414,7 @@ reinstall_init() {
kill -9 $pid kill -9 $pid
kill -SIGUSR1 "$(ps --pid $$ -oppid=)"; exit 1 kill -SIGUSR1 "$(ps --pid $$ -oppid=)"; exit 1
fi fi
sleep 5 sleep 5
((count++)) ((count++))
done done
@@ -1671,6 +1674,8 @@ salt_checkin() {
count=0 count=0
while ! (check_salt_minion_status); do while ! (check_salt_minion_status); do
echo "salt master did not get a job response from salt minion" >> "$setup_log" 2>&1 echo "salt master did not get a job response from salt minion" >> "$setup_log" 2>&1
systemctl kill salt-minion
systemctl start salt-minion
if [ $count -gt 30 ]; then if [ $count -gt 30 ]; then
echo "salt master did not get a job response from salt minion after 30 attempts, exiting" >> "$setup_log" 2>&1 echo "salt master did not get a job response from salt minion after 30 attempts, exiting" >> "$setup_log" 2>&1
kill -SIGUSR1 "$(ps --pid $$ -oppid=)"; exit 1 kill -SIGUSR1 "$(ps --pid $$ -oppid=)"; exit 1