]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Spamassassin: Add messages about rules loading
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 1 Apr 2019 12:51:03 +0000 (13:51 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 1 Apr 2019 12:51:03 +0000 (13:51 +0100)
Issue: #2828
Closes: #2828
src/plugins/lua/spamassassin.lua

index 9160b57c6400c8803e530f2920a86441b1c3362f..2e34201a4039bc9cbb154ef94cda65c2b55d7152 100644 (file)
@@ -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