mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-04-12 15:52:46 +02:00
only append "-mappings" to component template names as needed
This commit is contained in:
@@ -98,6 +98,7 @@ check_heavynode_compatiable_index_template() {
|
||||
load_component_templates() {
|
||||
local printed_name="$1"
|
||||
local pattern="${ELASTICSEARCH_TEMPLATES_DIR}/component/$2"
|
||||
local append_mappings="${3:-"false"}"
|
||||
|
||||
# current state of nullglob shell option
|
||||
shopt -q nullglob && nullglob_set=1 || nullglob_set=0
|
||||
@@ -106,7 +107,13 @@ load_component_templates() {
|
||||
echo -e "\nLoading $printed_name component templates...\n"
|
||||
for component in "$pattern"/*.json; do
|
||||
tmpl_name=$(basename "${component%.json}")
|
||||
if ! load_template "_component_template/${tmpl_name}-mappings" "$component"; then
|
||||
|
||||
if [[ "$append_mappings" == "true" ]]; then
|
||||
# avoid duplicating "-mappings" if it already exists in the component template filename
|
||||
tmpl_name="${tmpl_name%-mappings}-mappings"
|
||||
fi
|
||||
|
||||
if ! load_template "_component_template/${tmpl_name}" "$component"; then
|
||||
LOAD_FAILURES=$((LOAD_FAILURES + 1))
|
||||
LOAD_FAILURES_NAMES+=("$component")
|
||||
fi
|
||||
@@ -138,9 +145,9 @@ if [[ "$FORCE" == "true" || ! -f "$SO_STATE_FILE_SUCCESS" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
load_component_templates "ECS" "ecs"
|
||||
load_component_templates "ECS" "ecs" "true"
|
||||
load_component_templates "Elastic Agent" "elastic-agent"
|
||||
load_component_templates "Security Onion" "securityonion"
|
||||
load_component_templates "Security Onion" "so"
|
||||
|
||||
component_templates=$(so-elasticsearch-component-templates-list)
|
||||
echo -e "Loading Security Onion index templates...\n"
|
||||
@@ -187,4 +194,4 @@ else
|
||||
|
||||
echo "Templates already loaded"
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user