mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
add error check & retries to elastic_fleet_bulk_package_install
This commit is contained in:
@@ -119,7 +119,9 @@ elastic_fleet_package_install() {
|
|||||||
|
|
||||||
elastic_fleet_bulk_package_install() {
|
elastic_fleet_bulk_package_install() {
|
||||||
BULK_PKG_LIST=$1
|
BULK_PKG_LIST=$1
|
||||||
curl -s -K /opt/so/conf/elasticsearch/curl.config -b "sid=$SESSIONCOOKIE" -L -X POST -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d@$1 "localhost:5601/api/fleet/epm/packages/_bulk"
|
if ! curl -sK /opt/so/conf/elasticsearch/curl.config -b "sid=$SESSIONCOOKIE" -L -X POST -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d@$1 "localhost:5601/api/fleet/epm/packages/_bulk" --retry 3 --fail 2>/dev/null; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
elastic_fleet_package_is_installed() {
|
elastic_fleet_package_is_installed() {
|
||||||
|
|||||||
@@ -160,7 +160,11 @@ if [[ -f $STATE_FILE_SUCCESS ]]; then
|
|||||||
|
|
||||||
for file in "${pkg_filename}_"*.json; do
|
for file in "${pkg_filename}_"*.json; do
|
||||||
[ -e "$file" ] || continue
|
[ -e "$file" ] || continue
|
||||||
elastic_fleet_bulk_package_install $file >> $BULK_INSTALL_OUTPUT
|
if ! elastic_fleet_bulk_package_install $file >> $BULK_INSTALL_OUTPUT; then
|
||||||
|
# integrations loaded my this script are non-essential and shouldn't cause exit, skip them for now next highstate run can retry
|
||||||
|
echo "Failed to complete a chunk of bulk package installs -- $file "
|
||||||
|
continue
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
# cleanup any temp files for chunked package install
|
# cleanup any temp files for chunked package install
|
||||||
rm -f ${pkg_filename}_*.json $BULK_INSTALL_PACKAGE_LIST
|
rm -f ${pkg_filename}_*.json $BULK_INSTALL_PACKAGE_LIST
|
||||||
|
|||||||
Reference in New Issue
Block a user