mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-01-30 20:03:32 +01:00
sync in background
This commit is contained in:
@@ -370,9 +370,9 @@ function syncElastic() {
|
||||
mv "${rolesTmpFile}" "${elasticRolesFile}"
|
||||
|
||||
if [[ -z "$SKIP_STATE_APPLY" ]]; then
|
||||
echo "Elastic state will be re-applied to affected minions. This may take several minutes..."
|
||||
echo "Elastic state will be re-applied to affected minions. This will run in the background and may take several minutes to complete."
|
||||
echo "Applying elastic state to elastic minions at $(date)" >> /opt/so/log/soc/sync.log 2>&1
|
||||
salt -C 'G@role:so-standalone or G@role:so-eval or G@role:so-import or G@role:so-manager or G@role:so-managersearch or G@role:so-searchnode or G@role:so-heavynode' state.apply elasticsearch queue=True >> /opt/so/log/soc/sync.log 2>&1
|
||||
salt --async -C 'G@role:so-standalone or G@role:so-eval or G@role:so-import or G@role:so-manager or G@role:so-managersearch or G@role:so-searchnode or G@role:so-heavynode' state.apply elasticsearch queue=True >> /opt/so/log/soc/sync.log 2>&1
|
||||
fi
|
||||
else
|
||||
echo "Newly generated users/roles files are incomplete; aborting."
|
||||
|
||||
@@ -120,17 +120,21 @@ function manage_user() {
|
||||
function manage_salt() {
|
||||
request=$1
|
||||
op=$(echo "$request" | jq -r .operation)
|
||||
minion=$(echo "$request" | jq -r .minion)
|
||||
if [[ -s $minion ]]; then
|
||||
minion=$(cat /etc/salt/minion | grep "id:" | awk '{print $2}')
|
||||
fi
|
||||
|
||||
case "$op" in
|
||||
state)
|
||||
log "Performing '$op' for '$state'"
|
||||
log "Performing '$op' for '$state' on minion '$minion'"
|
||||
state=$(echo "$request" | jq -r .state)
|
||||
response=$(salt '*' state.apply "$state" queue=True)
|
||||
response=$(salt --async $minion state.apply "$state" queue=True)
|
||||
exit_code=$?
|
||||
;;
|
||||
highstate)
|
||||
log "Performing '$op'"
|
||||
response=$(salt '*' state.highstate queue=True)
|
||||
log "Performing '$op' on minion '$minion'"
|
||||
response=$(salt --async $minion state.highstate queue=True)
|
||||
exit_code=$?
|
||||
;;
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user