diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-01 15:09:38 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-01 15:12:21 +0000 |
commit | e4eab3822fe257ed4a044390a04eaba9a126afcd (patch) | |
tree | c7cfe994d3cd0af2e164419e5cb540b192582d83 /lualib/lua_cfg_transform.lua | |
parent | 14ab599deade88111e5bf6cd404ae4cf0c32a350 (diff) | |
download | rspamd-e4eab3822fe257ed4a044390a04eaba9a126afcd.tar.gz rspamd-e4eab3822fe257ed4a044390a04eaba9a126afcd.zip |
[Minor] Add warning about conflictin local files
Diffstat (limited to 'lualib/lua_cfg_transform.lua')
-rw-r--r-- | lualib/lua_cfg_transform.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lualib/lua_cfg_transform.lua b/lualib/lua_cfg_transform.lua index 717ce5a22..8a61dcd29 100644 --- a/lualib/lua_cfg_transform.lua +++ b/lualib/lua_cfg_transform.lua @@ -16,6 +16,7 @@ limitations under the License. local logger = require "rspamd_logger" local lua_util = require "lua_util" +local rspamd_util = require "rspamd_util" local function is_implicit(t) local mt = getmetatable(t) @@ -216,6 +217,21 @@ local function merge_groups(groups) return ret end +-- Checks configuration files for statistics +local function check_statistics_sanity() + local local_conf = rspamd_paths['LOCAL_CONFDIR'] + local local_stat = string.format('%s/local.d/%s', local_conf, + 'statistic.conf') + local local_bayes = string.format('%s/local.d/%s', local_conf, + 'classifier-bayes.conf') + + if rspamd_util.file_exists(local_stat) and + rspamd_util.file_exists(local_bayes) then + logger.warnx(rspamd_config, 'conflicting files %s and %s are found: '.. + 'Rspamd classifier configuration might be broken!', local_stat, local_bayes) + end +end + return function(cfg) local ret = false @@ -226,6 +242,8 @@ return function(cfg) ret = true end + check_statistics_sanity() + if not cfg.actions then logger.errx('no actions defined') else |