diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-05 13:25:41 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-05 13:25:41 +0000 |
commit | e60133edee33d87524e585d47c9b689f818b29da (patch) | |
tree | 6aa160b622991b0aeedb0b90aa716cf95d094ae5 /lualib | |
parent | b9d38aa0978e89c981d9d12785b51c6b01b42a88 (diff) | |
download | rspamd-e60133edee33d87524e585d47c9b689f818b29da.tar.gz rspamd-e60133edee33d87524e585d47c9b689f818b29da.zip |
[Fix] More hacks to deal with old configs
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/rspamd_config_transform.lua | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lualib/rspamd_config_transform.lua b/lualib/rspamd_config_transform.lua index cf19ca3ed..006c22d45 100644 --- a/lualib/rspamd_config_transform.lua +++ b/lualib/rspamd_config_transform.lua @@ -51,9 +51,9 @@ local function metric_pairs(t) else -- Very tricky to distinguish: -- group {name = "foo" ... } + group "blah" { ... } - for k,v in pairs(tbl) do - if type(k) ~= 'number' then - table.insert(keys, {k, v}) + for gr_name,gr in pairs(v) do + if type(gr_name) ~= 'number' then + table.insert(keys, {gr_name, gr}) end end end @@ -159,10 +159,6 @@ local function test_groups(groups) end local function convert_metric(cfg, metric) - if type(metric[1]) == 'table' then - logger.warnx("multiple metrics have never been supported") - metric = metric[1] - end if metric.actions then cfg.actions = override_defaults(metric.actions) logger.warnx("overriding actions from the legacy metric settings") @@ -195,7 +191,9 @@ return function(cfg) local ret = false if cfg['metric'] then - cfg = convert_metric(cfg, cfg.metric) + for _, v in metric_pairs(cfg.metric) do + cfg = convert_metric(cfg, v) + end ret = true end |