commit 86c1138: [Minor] Selectors: Add scan_result extractor

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Apr 23 15:14:09 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-04-23 16:13:26 +0100
URL: https://github.com/rspamd/rspamd/commit/86c11386cf43e7b841a8673d2552913084bbd406 (HEAD -> master)

[Minor] Selectors: Add scan_result extractor

---
 lualib/lua_selectors/extractors.lua | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lualib/lua_selectors/extractors.lua b/lualib/lua_selectors/extractors.lua
index c40b93b3b..6e023c780 100644
--- a/lualib/lua_selectors/extractors.lua
+++ b/lualib/lua_selectors/extractors.lua
@@ -428,8 +428,18 @@ The first argument must be header name.]],
       'Returns the symbol table. See task:get_symbol()',
     ['args_schema'] = {ts.string, ts.string:is_optional()}
   },
-
-
+  -- Get full scan result
+  ['scan_result'] = {
+    ['get_value'] = function(task, args)
+      local res = task:get_metric_result(args[1])
+      if res then
+        return res,'table'
+      end
+    end,
+    ['description'] = 'Get full scan result (either default or shadow if shadow result name is specified)' ..
+        'Returns the result table. See task:get_metric_result()',
+    ['args_schema'] = {ts.string:is_optional()}
+  },
 }
 
 return extractors


More information about the Commits mailing list