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 <mark.stemm@gmail.com>
This commit is contained in:
Mark Stemm 2020-09-17 16:18:31 -07:00 committed by poiana
parent 07abb89f36
commit 4f192e89fa

View File

@ -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: