mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-05-05 10:58:05 +02:00
sync in background
This commit is contained in:
@@ -370,9 +370,9 @@ function syncElastic() {
|
|||||||
mv "${rolesTmpFile}" "${elasticRolesFile}"
|
mv "${rolesTmpFile}" "${elasticRolesFile}"
|
||||||
|
|
||||||
if [[ -z "$SKIP_STATE_APPLY" ]]; then
|
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
|
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
|
fi
|
||||||
else
|
else
|
||||||
echo "Newly generated users/roles files are incomplete; aborting."
|
echo "Newly generated users/roles files are incomplete; aborting."
|
||||||
|
|||||||
@@ -120,17 +120,21 @@ function manage_user() {
|
|||||||
function manage_salt() {
|
function manage_salt() {
|
||||||
request=$1
|
request=$1
|
||||||
op=$(echo "$request" | jq -r .operation)
|
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
|
case "$op" in
|
||||||
state)
|
state)
|
||||||
log "Performing '$op' for '$state'"
|
log "Performing '$op' for '$state' on minion '$minion'"
|
||||||
state=$(echo "$request" | jq -r .state)
|
state=$(echo "$request" | jq -r .state)
|
||||||
response=$(salt '*' state.apply "$state" queue=True)
|
response=$(salt --async $minion state.apply "$state" queue=True)
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
;;
|
;;
|
||||||
highstate)
|
highstate)
|
||||||
log "Performing '$op'"
|
log "Performing '$op' on minion '$minion'"
|
||||||
response=$(salt '*' state.highstate queue=True)
|
response=$(salt --async $minion state.highstate queue=True)
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
Reference in New Issue
Block a user