diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-04-01 13:51:03 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-04-01 13:51:03 +0100 |
commit | 302da75c22217d0c8c0a6a868b85e81df8f63dd0 (patch) | |
tree | 9dd0a2f3f3338edc7c3032fcb1972f537433f9ee /src/plugins/lua/spamassassin.lua | |
parent | f0d72001587ab4027a90abd89d1895b73754f010 (diff) | |
download | rspamd-302da75c22217d0c8c0a6a868b85e81df8f63dd0.tar.gz rspamd-302da75c22217d0c8c0a6a868b85e81df8f63dd0.zip |
[Minor] Spamassassin: Add messages about rules loading
Issue: #2828
Closes: #2828
Diffstat (limited to 'src/plugins/lua/spamassassin.lua')
-rw-r--r-- | src/plugins/lua/spamassassin.lua | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index 9160b57c6..2e34201a4 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -1616,28 +1616,39 @@ if type(section) == "table" then for _, elt in ipairs(fn) do local files = util.glob(elt) + if not files or #files == 0 then + rspamd_logger.errx(rspamd_config, "cannot find any files matching pattern %s", elt) + else + for _,matched in ipairs(files) do + local f = io.open(matched, "r") + if f then + rspamd_logger.infox(rspamd_config, 'loading SA rules from %s', matched) + process_sa_conf(f) + has_rules = true + else + rspamd_logger.errx(rspamd_config, "cannot open %1", matched) + end + end + end + end + else + -- assume string + local files = util.glob(fn) + + if not files or #files == 0 then + rspamd_logger.errx(rspamd_config, "cannot find any files matching pattern %s", fn) + else for _,matched in ipairs(files) do local f = io.open(matched, "r") if f then + rspamd_logger.infox(rspamd_config, 'loading SA rules from %s', matched) process_sa_conf(f) has_rules = true else rspamd_logger.errx(rspamd_config, "cannot open %1", matched) end end - end - else - -- assume string - local files = util.glob(fn) - for _,matched in ipairs(files) do - local f = io.open(matched, "r") - if f then - process_sa_conf(f) - has_rules = true - else - rspamd_logger.errx(rspamd_config, "cannot open %1", matched) - end end end end |