mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-03-03 19:35:35 +01:00
Merge pull request #15534 from Security-Onion-Solutions/bravo
restart salt minion before failing if not ready
This commit is contained in:
@@ -1825,6 +1825,25 @@ verify_es_version_compatibility() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wait_for_salt_minion_with_restart() {
|
||||||
|
local minion="$1"
|
||||||
|
local max_wait="${2:-60}"
|
||||||
|
local interval="${3:-3}"
|
||||||
|
local logfile="$4"
|
||||||
|
|
||||||
|
wait_for_salt_minion "$minion" "$max_wait" "$interval" "$logfile"
|
||||||
|
local result=$?
|
||||||
|
|
||||||
|
if [[ $result -ne 0 ]]; then
|
||||||
|
echo "$(date '+%a %d %b %Y %H:%M:%S.%6N') - salt-minion not ready, attempting restart..."
|
||||||
|
systemctl_func "restart" "salt-minion"
|
||||||
|
wait_for_salt_minion "$minion" "$max_wait" "$interval" "$logfile"
|
||||||
|
result=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
return $result
|
||||||
|
}
|
||||||
|
|
||||||
run_airgap_intermediate_upgrade() {
|
run_airgap_intermediate_upgrade() {
|
||||||
local originally_requested_so_version=$(cat $UPDATE_DIR/VERSION)
|
local originally_requested_so_version=$(cat $UPDATE_DIR/VERSION)
|
||||||
# preserve ISOLOC value, so we can try to use it post intermediate upgrade
|
# preserve ISOLOC value, so we can try to use it post intermediate upgrade
|
||||||
@@ -2075,7 +2094,7 @@ apply_hotfix() {
|
|||||||
mv /etc/pki/managerssl.crt /etc/pki/managerssl.crt.old
|
mv /etc/pki/managerssl.crt /etc/pki/managerssl.crt.old
|
||||||
mv /etc/pki/managerssl.key /etc/pki/managerssl.key.old
|
mv /etc/pki/managerssl.key /etc/pki/managerssl.key.old
|
||||||
systemctl_func "start" "salt-minion"
|
systemctl_func "start" "salt-minion"
|
||||||
wait_for_salt_minion "$MINIONID" "120" "4" "$SOUP_LOG" || fail "Salt minion was not running or ready."
|
wait_for_salt_minion_with_restart "$MINIONID" "60" "3" "$SOUP_LOG" || fail "Salt minion was not running or ready."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "No actions required. ($INSTALLEDVERSION/$HOTFIXVERSION)"
|
echo "No actions required. ($INSTALLEDVERSION/$HOTFIXVERSION)"
|
||||||
@@ -2275,7 +2294,7 @@ main() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Running a highstate. This could take several minutes."
|
echo "Running a highstate. This could take several minutes."
|
||||||
set +e
|
set +e
|
||||||
wait_for_salt_minion "$MINIONID" "120" "4" "$SOUP_LOG" || fail "Salt minion was not running or ready."
|
wait_for_salt_minion_with_restart "$MINIONID" "60" "3" "$SOUP_LOG" || fail "Salt minion was not running or ready."
|
||||||
highstate
|
highstate
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -2288,7 +2307,7 @@ main() {
|
|||||||
check_saltmaster_status
|
check_saltmaster_status
|
||||||
|
|
||||||
echo "Running a highstate to complete the Security Onion upgrade on this manager. This could take several minutes."
|
echo "Running a highstate to complete the Security Onion upgrade on this manager. This could take several minutes."
|
||||||
wait_for_salt_minion "$MINIONID" "120" "4" "$SOUP_LOG" || fail "Salt minion was not running or ready."
|
wait_for_salt_minion_with_restart "$MINIONID" "60" "3" "$SOUP_LOG" || fail "Salt minion was not running or ready."
|
||||||
|
|
||||||
# Stop long-running scripts to allow potentially updated scripts to load on the next execution.
|
# Stop long-running scripts to allow potentially updated scripts to load on the next execution.
|
||||||
if pgrep salt-relay.sh > /dev/null 2>&1; then
|
if pgrep salt-relay.sh > /dev/null 2>&1; then
|
||||||
|
|||||||
Reference in New Issue
Block a user