From 356da0039509ee4e256a74d8d917c06de875e593 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Thu, 20 Aug 2026 13:29:38 -0400 Subject: [PATCH] Ignore malformed logstash pipeline_settings instead of failing the state A non-mapping value under logstash:pipeline_settings: made config.sls raise "'str object' has no attribute 'get'", which failed the whole logstash.config render rather than just skipping the bad value. pipelines.yml.jinja already guarded this; config.sls now does too, and logs which pipeline was ignored. --- salt/logstash/config.sls | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/salt/logstash/config.sls b/salt/logstash/config.sls index a661e96cc..1c5b6e9e2 100644 --- a/salt/logstash/config.sls +++ b/salt/logstash/config.sls @@ -82,7 +82,11 @@ ls_custom_pipeline_conf_{{assigned_pipeline}}_{{pipeline}}: {% for assigned_pipeline in ASSIGNED_PIPELINES %} {# a blank per-pipeline setting falls back to the global logstash.yml value #} -{% set PIPELINE_OVERRIDES = LOGSTASH_MERGED.get('pipeline_settings', {}).get(assigned_pipeline, {}) %} +{% set PARSED_OVERRIDES = LOGSTASH_MERGED.get('pipeline_settings', {}).get(assigned_pipeline, {}) %} +{% if PARSED_OVERRIDES is not mapping %} +{% do salt.log.warning('logstash: ignoring malformed pipeline_settings for pipeline ' ~ assigned_pipeline ~ '; expected a set of settings') %} +{% endif %} +{% set PIPELINE_OVERRIDES = PARSED_OVERRIDES if PARSED_OVERRIDES is mapping else {} %} {% set THREADS = PIPELINE_OVERRIDES.get('pipeline_x_workers') or LOGSTASH_MERGED.config.pipeline_x_workers %} {% set BATCH = PIPELINE_OVERRIDES.get('pipeline_x_batch_x_size') or LOGSTASH_MERGED.config.pipeline_x_batch_x_size %} {% for CONFIGFILE in LOGSTASH_MERGED.defined_pipelines[assigned_pipeline] %}