mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-06-23 02:38:09 +02:00
41 lines
1.4 KiB
Bash
41 lines
1.4 KiB
Bash
#!/bin/bash
|
|
|
|
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
|
|
# or more contributor license agreements. Licensed under the Elastic License 2.0; you may not use
|
|
# this file except in compliance with the Elastic License 2.0.
|
|
{%- import_yaml 'elasticfleet/defaults.yaml' as ELASTICFLEETDEFAULTS %}
|
|
{%- set SUPPORTED_PACKAGES = salt['pillar.get']('elasticfleet:packages', default=ELASTICFLEETDEFAULTS.elasticfleet.packages, merge=True) %}
|
|
|
|
. /usr/sbin/so-elastic-fleet-common
|
|
|
|
PKG_LOAD_FAILURES=0
|
|
PKG_LOAD_FAILURES_NAMES=()
|
|
|
|
{%- for PACKAGE in SUPPORTED_PACKAGES %}
|
|
echo "Upgrading {{ PACKAGE }} package..."
|
|
if VERSION=$(elastic_fleet_package_latest_version_check "{{ PACKAGE }}"); then
|
|
if ! elastic_fleet_package_install "{{ PACKAGE }}" "$VERSION"; then
|
|
PKG_LOAD_FAILURES=$((PKG_LOAD_FAILURES + 1))
|
|
PKG_LOAD_FAILURES_NAMES+=("{{ PACKAGE }}")
|
|
fi
|
|
else
|
|
PKG_LOAD_FAILURES=$((PKG_LOAD_FAILURES + 1))
|
|
PKG_LOAD_FAILURES_NAMES+=("{{ PACKAGE }}")
|
|
fi
|
|
echo
|
|
{%- endfor %}
|
|
|
|
if [ $PKG_LOAD_FAILURES -gt 0 ]; then
|
|
echo "ERROR: Failed to upgrade $PKG_LOAD_FAILURES package(s):"
|
|
for PKG in "${PKG_LOAD_FAILURES_NAMES[@]}"; do
|
|
echo " - $PKG"
|
|
done
|
|
# exit 1 on failure to upgrade a default package, allow salt to handle retries
|
|
exit 1
|
|
else
|
|
echo "Successfully upgraded all packages."
|
|
fi
|
|
|
|
echo
|
|
/usr/sbin/so-elasticsearch-templates-load
|