Merge branch 'upgrade/salt3006.3' into upgrade/salt3006.3v2

This commit is contained in:
m0duspwnens
2023-10-27 10:58:09 -04:00
2 changed files with 3 additions and 17 deletions

View File

@@ -152,12 +152,12 @@ check_salt_master_status() {
return 0 return 0
} }
# this is only intended to be used to check the status of the minion # this is only intended to be used to check the status of the minion from a salt master
check_salt_minion_status() { check_salt_minion_status() {
local minion="$1" local minion="$1"
local timeout="${2:-5}" local timeout="${2:-5}"
local logfile="${3:-'/dev/stdout'}" local logfile="${3:-'/dev/stdout'}"
echo "Checking if the salt minion will respond to jobs" >> "$logfile" 2>&1 echo "Checking if the salt minion: $minion will respond to jobs" >> "$logfile" 2>&1
salt "$minion" test.ping -t $timeout > /dev/null 2>&1 salt "$minion" test.ping -t $timeout > /dev/null 2>&1
local status=$? local status=$?
if [ $status -gt 0 ]; then if [ $status -gt 0 ]; then

View File

@@ -1258,7 +1258,7 @@ generate_ssl() {
# if the install type is a manager then we need to wait for the minion to be ready before trying # if the install type is a manager then we need to wait for the minion to be ready before trying
# to run the ssl state since we need the minion to sign the certs # to run the ssl state since we need the minion to sign the certs
if [[ "$install_type" =~ ^(EVAL|MANAGER|MANAGERSEARCH|STANDALONE|IMPORT|HELIXSENSOR)$ ]]; then if [[ "$install_type" =~ ^(EVAL|MANAGER|MANAGERSEARCH|STANDALONE|IMPORT|HELIXSENSOR)$ ]]; then
wait_for_salt_minion "$MINION_ID" "5" "$setup_log" || fail_setup (wait_for_salt_minion "$MINION_ID" "5" '/dev/stdout' || fail_setup) 2>&1 | tee -a "$setup_log"
fi fi
info "Applying SSL state" info "Applying SSL state"
logCmd "salt-call state.apply ssl -l info" logCmd "salt-call state.apply ssl -l info"
@@ -2494,20 +2494,6 @@ wait_for_file() {
return 1 return 1
} }
wait_for_salt_minion() {
retry 60 5 "journalctl -u salt-minion.service | grep 'Minion is ready to receive requests'" >> "$setup_log" 2>&1 || fail_setup
local attempt=0
# each attempts would take about 15 seconds
local maxAttempts=20
until check_salt_minion_status; do
attempt=$((attempt+1))
if [[ $attempt -eq $maxAttempts ]]; then
fail_setup
fi
sleep 10
done
}
verify_setup() { verify_setup() {
info "Verifying setup" info "Verifying setup"
set -o pipefail set -o pipefail