From 6f24c709d32e38649ddf053ae7d3d66219446752 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 14 Feb 2018 10:22:18 +0000 Subject: [PATCH] [Minor] Fix groups check for symbols --- lualib/rspamd_config_transform.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lualib/rspamd_config_transform.lua b/lualib/rspamd_config_transform.lua index e74c0f689..6b9e0ec27 100644 --- a/lualib/rspamd_config_transform.lua +++ b/lualib/rspamd_config_transform.lua @@ -152,16 +152,20 @@ local function symbol_transform(cfg, k, v) return end end + -- Now check what Rspamd knows about this symbol + local sym = rspamd_config:get_metric_symbol(k) + + if not k or not k.group then + -- Otherwise we just use group 'ungrouped' + if not cfg.group.ungrouped then + cfg.group.ungrouped = { + symbols = {} + } + end - -- Otherwise we just use group 'ungrouped' - if not cfg.group.ungrouped then - cfg.group.ungrouped = { - symbols = {} - } + cfg.group.ungrouped.symbols[k] = v + logger.infox("adding symbol %s to the group 'ungrouped'", k) end - - cfg.group.ungrouped.symbols[k] = v - logger.infox("adding symbol %s to the group 'ungrouped'", k) end local function test_groups(groups) -- 2.39.5