From 4f192e89fa765626327d83e8a78878d2554709ef Mon Sep 17 00:00:00 2001 From: Mark Stemm Date: Thu, 17 Sep 2020 16:18:31 -0700 Subject: [PATCH] Allow unknown top level objs as warnings When parsing a rules file, if a top level object is not one of the known types rule, macro, list, required_engine_version, instead of failing parsing, add a warning instead. This adds some forwards-compatibility to rules files. Signed-off-by: Mark Stemm --- userspace/engine/lua/rule_loader.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/userspace/engine/lua/rule_loader.lua b/userspace/engine/lua/rule_loader.lua index 0712bede..14cec263 100644 --- a/userspace/engine/lua/rule_loader.lua +++ b/userspace/engine/lua/rule_loader.lua @@ -448,14 +448,14 @@ function load_rules_doc(rules_mgr, doc, load_state) end end else - -- Remove the context from the table, so the table is exactly what was parsed local context = v['context'] - v['context'] = nil - return false, build_error_with_context(context, "Unknown rule object: "..table.tostring(v)), warnings + + arr = build_error_with_context(context, "Unknown top level object: "..table.tostring(v)) + warnings[#warnings + 1] = arr[1] end end - return true, {}, {} + return true, {}, warnings end -- Returns: